How to change the user shell
The default command-line interpreter or shell in most distros is Bash, but you can install another shell from your system repositories and turn it into your default shell.
Install a shell
First step is, obviously, to install a shell. There are several shells (check my list) but for this tutorial I am going to use Fish.
# Debian/Ubuntu
sudo apt install fish
# Arch
sudo pacman -S fish
You can run Fish inside your current shell by typing fish
.
Change default user shell
We can use chsh
to change user login shell. First, you need to know the full path of your new shell (run which fish
). chsh
will accept the full pathname of any executable file on the system. The default behavior for non-root users is to accept only shells listed in the /etc/shells
file, and issue a warning for root user. It can also be configured at compile-time to only issue a warning for all users.
$ cat /etc/shells
# Pathnames of valid login shells.
# See shells(5) for details.
/bin/sh
/bin/bash
/usr/bin/git-shell
Run chsh
with the parameter -s
and the shell path.
chsh -s /usr/bin/fish
Type your user password and log out. When you log in again, your default shell will be Fish.
You can also edit /etc/passwd
and change the last part of your user’s line.
# User 'ricardo'
ricardo:x:1000:1000::/home/ricardo:/bin/bash
If you have any suggestion, feel free to contact me via social media or email.
Latest tutorials and articles:
Featured content: