1、检查当前shell
myMacBook-Pro:/ zzz$ echo $SHELL /bin/bash
其实终端窗口的标题栏上显示着当前shell的名字呢。
2、检查系统支持的所有shell
myMacBook-Pro:/ zzz$ cat /etc/shells # List of acceptable shells for chpass(1). # Ftpd will not allow users to connect who are not using # one of these shells. /bin/bash /bin/csh /bin/dash /bin/ksh /bin/sh /bin/tcsh /bin/zsh
3、切换到某个shell,如zsh
myMacBook-Pro:~ zzz$ chsh -s /bin/zsh Changing shell for zzz Password for zzz: ***
为了验证是否成功,需要退出当前终端,重新开启终端窗口,可以检查$SHELL的值已经改变
myMacBook-Pro:/ zzz$ echo $SHELL /bin/zsh
EOF