Loading...
X

How to find out which shell is in use in Linux

Linux shells

There are several Linux shells, each with its own characteristics. Examples of popular shells are Bash (which is the default shell on many distributions) and ZSH (which is the default shell on Kali Linux, it has many fans).

The shell information is contained in the $SHELL environment variable to see its value and to find out which shell is in use, run the command:

echo $SHELL

See what exactly will be displayed:

  • /bin/bash - means you have Bash
  • /usr/bin/zsh - means you have ZSH

How to find out which Linux shell is actually being used

But is it really that simple with shells?

Take a look at the following screenshot and try to guess which shell will handle subsequent commands?

The screenshot clearly shows that the command printed “/usr/bin/zsh”, so we can say that it is using the ZSH shell.

But this is the wrong answer.

Yes, the default shell on this system is ZSH, but just above the command is

bash

and even though the decoration or the command line prompt hasn't changed, Bash now handles the commands you enter.

This is easy to prove if you run the command

help

then Bash will show you a quick reference for its commands. And ZSH will display a message that the command was not found:

What does the $SHELL variable actually show? Apparently, this is just the default shell on this system, without taking into account the fact that the user could start another shell. However, outputting the value of the $SHELL variable will in most cases answer the question of which shell is being used on that system.

To verify that you are using Bash, you can run the command:

help

Another way to “reveal” Bash is to look at how the Ctrl+x Ctrl+v keystrokes respond. In response, Bash will print a line similar to the following:

GNU bash, версия 5.1.4(1)-release (x86_64-pc-linux-gnu)

Related: How to change the login shell in Linux. chsh instruction


Leave Your Observation

Your email address will not be published.