80

Let's say, I opened a terminal and entered / executed some shell commands.

But I didn't invoke explicitly Bash or any other shell.

What shell was used by default?

BuZZ-dEE
  • 14,533

6 Answers6

74

The one specified on your line in /etc/passwd (it is a : separated line and the shell is the final one).

For example mine:

chris:x:1000:1000:Chris,,,:/home/chris:/bin/bash

Here it is /bin/bash (the Ubuntu default)

You can also use chsh:

$ chsh
Password: 
Changing the login shell for chris
Enter the new value, or press ENTER for the default
        Login Shell [/bin/bash]:

This is telling me my shell is /bin/bash and letting me change it.

Finally, echo $SHELL will do the same:

$ echo $SHELL
/bin/bash
BuZZ-dEE
  • 14,533
Caesium
  • 16,207
  • 4
  • 42
  • 48
30

typing the following will display what shell the terminal opened with:

echo $SHELL

However, to find out what shell you are currently in (you may have changed it) type

ps -p $$

e.g. you will see that the shell is bash in the example output

  PID TTY          TIME CMD
 3500 pts/0    00:00:01 bash

Another method is to use

echo $0

this will simply return the name of the current shell.

fossfreedom
  • 174,526
21

GNU Bash is the shell used by default in terminals on Ubuntu. However when scripts are executed on system boot then dash is used, as it is dash that is /bin/sh.

This is defined in the $SHELL environmental variable. You can check by typing echo $SHELL in the terminal.

Anonymous
  • 11,979
6

By default it's bash:

env | grep ^SHELL=

In most cases will produce

SHELL=/bin/bash
wojox
  • 11,840
4

To get file path of current shell executable one can use

readlink -f /proc/$$/exe

Some possible outputs are:

  • /bin/bash
  • /usr/bin/bash
  • /usr/bin/zsh
  • /home/victor/.linuxbrew/Cellar/zsh/5.2/bin/zsh
0

Easiest way to check your terminal is by using pinky command:

pinky -l YourUsername

to change your default shell as the above answers already did, use chsh or manually edit /etc/passwd