Linux shell chsh 命令
Linux shell chsh命令用于更改使用者 shell 设定。 使用权限:所有可登陆用户 chsh 命令语法格式 chsh [选项] [用户名] 选项 -s, --shell <shell> 指定登录的 shell -l, --list-shells 输出目前可用的所有 shell -u, --help 显示帮助信息 -v, --version 显示 chsh 的版本信息 范例 列出所有可用的 shell 其实就是输出 etc/shells 文件的内容 [root@localhost shell]# chsh -l /bin/sh /bin/bash /sbin/nologin /usr/bin/sh /usr/bin/bash /usr/sbin/nologin /bin/tcsh /bin/csh 查看当前的 shell [root@localhost shell]# chsh Changing shell for root. New shell [/bin/bash]: # 直接按回车键 [] 里的是目前使用的 shell 改变当前的shell 当前的 shell 设置为 /bin/bash ,通过 chsh 命令,改变 shell 的设置 /bin/csh [root@localhost shell]# chsh Changing shell for root. New shell [/bin/bash]: /bin/csh # 输入新的shell地址 Shell changed. 通过 -s 参数改变当前的shell设置 改变当前设置为 /bin/csh [root@localhost shell]# chsh -s /bin/csh Changing shell for root. Shell changed. [root@localhost shell]# 返回上一级
Linux shell chsh命令用于更改使用者 shell 设定。
使用权限:所有可登陆用户
chsh 命令语法格式
chsh [选项] [用户名]
选项
-s, --shell <shell> 指定登录的 shell -l, --list-shells 输出目前可用的所有 shell -u, --help 显示帮助信息 -v, --version 显示chsh 的版本信息
范例
列出所有可用的 shell
其实就是输出 etc/shells 文件的内容
[root@localhost shell]# chsh -l /bin/sh /bin/bash /sbin/nologin /usr/bin/sh /usr/bin/bash /usr/sbin/nologin /bin/tcsh /bin/csh
查看当前的 shell
[root@localhost shell]# chsh Changing shell for root. New shell [/bin/bash]: # 直接按回车键 [] 里的是目前使用的 shell
改变当前的shell
当前的 shell 设置为 /bin/bash ,通过 chsh 命令,改变 shell 的设置 /bin/csh
[root@localhost shell]# chsh Changing shell for root. New shell [/bin/bash]: /bin/csh # 输入新的shell地址 Shell changed.
通过 -s 参数改变当前的shell设置
改变当前设置为 /bin/csh
[root@localhost shell]# chsh -s /bin/csh Changing shell for root. Shell changed. [root@localhost shell]#
交流与评论