Did you install a new shell on your Linux system and now want to make it your permanent choice? Or perhaps the new distribution youโre trying comes with a shell that doesnโt quite suit you, and youโd prefer to return to the familiar comforts of a good old Bash? No worries at all!
This guide will walk you through effortlessly changing your Linux shell in just a few minutes. Letโs get started.
Changing Your Linux Shell
In Linux, the shell acts as an intermediary between the user and the operating system, processing commands and returning output.
Itโs important to understand that you can install multiple shells on your system and switch between them as needed. You can also temporarily change shells for a single session or permanently setย
Here’s how to check what shells are currently installed on your Linux system:
cat /etc/shells
Code language: Bash (bash)
To check which shell you are currently using, run:
echo $SHELL
Code language: Bash (bash)
From the command output, it’s clear that we’re currently using Bash as our shell.
Switching Temporarily to Another Linux Shell
Suppose we’d like to switch to using Fishโassuming it’s already installed on our Linux system. To make the switch, we just need to enter the command fish
.
Our terminal will immediately switch to it. Justย type exit
to leave the current shell and get back to Bash.
Thisย is all helpful, but remember thatย these changes are only temporary. When you close the terminal or start a new one, it will revert to the default shell.
Switching Permanently to Another Linux Shell
However, if you wantย to permanently switch to a different shell, you’ll want to use the chsh
(change shell) command. This utility allows a user to permanently change their default command-line shell in Linux.
The process isย quiteย straightforward and involves two steps. First, you’ll need to locate the complete absolute path to the shell’s executable binary.ย To do this,ย simplyย run the command below and use only the shell’s name as an argument, in this case, “fish.”
which fish
Code language: Bash (bash)
Next, run the chsh
command with the “-s” option and provide the full path to the shell as an argument. When prompted, enter your user password and press “Enter” to confirm.
chsh -s /usr/bin/fish
Code language: Bash (bash)
That’s it. You must log out for the changes to be applied. When you log back in, your new shell will be the default for your account. In addition, you can verify this by checking your account entry in the “/etc/passwd” file.
Bottom Line
Switching between Linux shells isย quiteย straightforward and only involves executing a single command: chsh
. With this tool, you can easily jump between different shells to find the one that suits you best. You can find more information regarding chsh
ย onย itsย manual page.
However, don’t forget that each shell has its configuration files where you can customize settings, aliases, functions, etc., or make visual improvements to suit your own tastes. Here are sample ones for the Bash shell.
Thanks for your time! We valueย your feedback and comments, so please feel free to share them in the section below.