Search

How to Replace Shell in Linux: An Effective Method

Share it

Have you implemented a fresh shell on your Linux setup and now wish to establish it as your permanent selection? Or maybe the latest distribution you’re experimenting with features a shell that doesn’t quite fit your preferences, and you’d rather return to the well-known comforts of a reliable Bash? No need to worry! This tutorial will guide you through seamlessly altering your Linux shell in just a matter of minutes. Let’s commence.

Procedure for Altering Your Linux Shell

Within Linux, the shell serves as a mediator between the user and the operating system, handling commands and returning outputs.

It’s vital to acknowledge that you can install multiple shells on your system and transition between them as required. You can also temporarily modify shells for a single session or configure them permanently.

To ascertain which shells are presently installed on your Linux system, execute the following command:

cat /etc/shellsCode language: Bash (bash)
Installed Linux shells.

To determine your current shell, type the following command:

echo $SHELLCode language: Bash (bash)
Checking current shell in use.
Checking current shell in use.

The output clearly indicates that our current shell is Bash.

Temporary Transition to Another Linux Shell

Suppose you desire to switch to Fish temporarily—provided it’s already installed on your Linux system. To make this shift, simply input the command fish.

Your terminal will promptly switch to Fish. To return to Bash, just type exit.

Temporarily changing among Linux shells.
Temporarily changing among Linux shells.

While this is helpful, remember that these adjustments are only temporary. Once you close the terminal or open a new one, it will revert to the default shell.

Permanent Transition to Another Linux Shell

Yet, if you wish to permanently transition to a different shell, employ the chsh (change shell) command. This tool allows a user to permanently alter their default command-line shell in Linux.

The process is straightforward and involves two steps. First, determine the complete path to the shell’s executable binary by executing the following command, utilizing only the shell’s name as an argument, e.g., “fish.”

which fishCode language: Bash (bash)

Subsequently, execute the chsh command with the “-s” option, providing the full path to the shell as an argument. Upon prompt, enter your user password and press “Enter” to confirm.

chsh -s /usr/bin/fishCode language: Bash (bash)
Permanently transitioning to a new Linux shell.
Permanently transitioning to a new Linux shell.

That’s it. Log out for the changes to take effect. Upon logging back in, your new shell will become the default for your account. Additionally, you can confirm this by examining your account entry in the “/etc/passwd” file.

Permanently transitioning to a new Linux shell.
Permanently transitioning to a new Linux shell.

Concluding Note

Swapping between Linux shells is simple and entails executing a single command: chsh. With this utility, you can conveniently switch between different shells to find the one that best suits your needs. Refer to the manual page for further details on chsh.

Nevertheless, each shell possesses its configuration files where you can tailor settings, aliases, functions, etc., or make visual enhancements to suit your preferences. Sample configurations are available for the Bash shell.

We appreciate your time! Your feedback and comments are valuable, so feel free to share them in the section below.

🤞 Don’t miss these tips!

🤞 Don’t miss these tips!

Solverwp- WordPress Theme and Plugin