linux mac查看系统支持哪些shell,切换更改用户shell

131 阅读1分钟

查看支持的bash和切换

查看支持的shell

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/ksh
/bin/sh
/bin/tcsh
/bin/zsh

输出列表即当前环境支持的bash

查看当前使用哪个shell

echo $SHELL

当前session会话使用某个shell

想让当前会话使用某个指定的shell,直接运行就可以。 如我想让当前terminal使用bash, 执行/bin/bash即可。

/bin/bash
或者  
bash -c "clear && /bin/bash"

结束bash,执行 exit即可。

当前terminal运行指定bash

更改用户的默认shell

chsh -s /bin/zsh  [用户名:模认当前用户]