How to Find Out Which Linux Shell You Are Currently Using

When you open a terminal window in Linux, you are interacting with a program called a “shell.” The shell is responsible for translating the commands you type (like ls or cd) into instructions the Linux kernel can understand.

While the vast majority of Linux distributions use Bash (Bourne Again SHell) as the default, many modern systems (like macOS and Kali Linux) have transitioned to Zsh. Other servers might use minimalist shells like sh or dash. If you are copying complex scripts from the internet, you must know exactly which shell you are currently running, as a script designed for Bash might completely fail to execute in Zsh.

Method 1: Checking the Shell Environment Variable

The fastest way to identify your default shell is to ask the operating system to print the contents of the $SHELL environment variable.

  1. Open your terminal window.
  2. Execute the following exact command (ensure the word SHELL is in all capital letters):
    echo $SHELL
  3. Press Enter.

The terminal will output an absolute file path. If it returns /bin/bash, you are using Bash. If it returns /bin/zsh or /usr/bin/zsh, you are using Zsh.

Method 2: Checking the Active Process Name

The $SHELL variable shows your default shell, but it might not reflect the shell you are currently using if you manually launched a different one. To see the exact name of the active shell process controlling your current terminal session, use the $0 parameter.

  1. Type the following command:
    echo $0
  2. Press Enter.

This command asks the active program to print its own name. It will usually output a much shorter string, such as bash, zsh, or -bash.

Method 3: Viewing the Process Tree

If you want absolute, undeniable proof of what program is handling your terminal inputs, you can view the active process list filtered by your current terminal’s Process ID.

  1. Execute this command:
    ps -p $$

This will generate a small table. Look at the very last column labeled CMD. The word listed there (e.g., bash) is the definitive, currently running shell executable.

Get the best tech tips delivered straight to your inbox.

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