← 返回命令列表

Linux command

chsh 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Example

chsh

List

chsh -l

Example

chsh -s [path/to/shell]

Example

sudo chsh -s [path/to/shell] [username]

说明

chsh changes a user's login shell, which is the program started when the user logs in via a terminal. The new shell must be listed in /etc/shells unless the change is made by root. Regular users can change their own shell; root can change any user's shell. The change takes effect on the next login. The user is authenticated before the change is made, so a password is required unless run as root. Common use cases include switching between bash, zsh, fish, or other shells. Part of the util-linux package on Linux systems.

参数

-s, --shell _shell_
Specify the new login shell
-l, --list-shells
List shells from /etc/shells
-h, --help
Display help message

FAQ

What is the chsh command used for?

chsh changes a user's login shell, which is the program started when the user logs in via a terminal. The new shell must be listed in /etc/shells unless the change is made by root. Regular users can change their own shell; root can change any user's shell. The change takes effect on the next login. The user is authenticated before the change is made, so a password is required unless run as root. Common use cases include switching between bash, zsh, fish, or other shells. Part of the util-linux package on Linux systems.

How do I run a basic chsh example?

Run `chsh` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -s, --shell _shell_ do in chsh?

Specify the new login shell