How to Find Out Which Shell You Are Using in Linux

The “shell” is the command-line interpreter that translates your typed commands into actions the Linux operating system can understand. While the Bourne Again Shell (Bash) is the default on the vast majority of Linux distributions, many modern systems (like macOS, which shares Unix roots) and specialized Linux setups now default to Zsh, Fish, or Dash.

If you are trying to customize your terminal prompt, edit your configuration files (like .bashrc or .zshrc), or troubleshoot a script, you must know exactly which shell you are currently operating in. Here are the most reliable ways to check.

Method 1: Print the $SHELL Environment Variable

The fastest way to check your default shell is to ask Linux to print the value of the $SHELL environment variable. This variable defines the path to the shell program that is launched when you open a new terminal window.

  1. Open your Linux terminal.
  2. Type the following command and press Enter:
    echo $SHELL

The terminal will output an absolute path. Common outputs include:

  • /bin/bash (You are using Bash)
  • /bin/zsh (You are using Zsh)
  • /bin/fish (You are using Fish)

Method 2: Check the Active Shell Process

While echo $SHELL tells you your default configured shell, it doesn’t always tell you what you are currently using. For example, if your default is Bash, but you typed zsh to temporarily switch to a new shell, echo $SHELL will still report /bin/bash.

To see exactly which shell process is currently interpreting your commands in the active window, use the $0 variable or check the current process ID.

Type the following command and press Enter:
echo $0

This will typically return the name of the active shell program, such as bash, -bash, or zsh.

Alternatively, you can ask the process manager to identify the program attached to your current process ID ($$):

ps -p $$

Look under the CMD column in the output table. The command listed there (e.g., bash) is your currently active shell.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.