How to find what shell I am using and default shell on Linux

Linux comes with a wide variety of shells. Shell provides a command-line interface to your OS. Some popular shells are bash, sh, Zsh, tcsh, csh and ksh. In this article we will find out which shell you are using on your Linux system and also the default shell on your Linux system and how many shells are installed in your system.

Check how many shells are installed on Linux

Open the terminal app (ctrl+alt+t) and run blow command to find out all installed shells on your Linux system first.

cat /etc/shells

How many shell installed

 

Which shell am I using?

Open the terminal command-line application using the ctrl+alt+t keys and run below command. It will show the currently using shell on your Ubuntu Linux system.

echo $0

Which shell 1

You can also check the shell using ps command. In the terminal app run below command.

ps

Which shell 3

 

Also Read:  How to Execute Install .run Files in Ubuntu

Another way to find out currently used shell.

sh -c 'ps -p $$ -o ppid=' | xargs -I'{}' readlink -f '/proc/{}/exe'

Which shell 2

Another method using grep command.

grep "^$USER" /etc/passwd

Which shell 6

Find my Default Shell

To find the default shell, run below command in the terminal. Sometime currently running shell may not be the default shell.

echo $SHELL

Which shell 2

That’s it.

If you liked this article, please subscribe to our YouTube Channel. You can also stay connected with us on X (Twitter) and Facebook.



Leave a Reply