Linux – How to find out which Shell you are using?

Here are three quick ways to find out which shell you are currently using:

Method 1:

command:

# echo $SHELL

output:

/bin/bash

Method 2:

command:

# echo $0

output:

-bash

Method 3:

command:

# ps -p $$

output:

 PID TTY               TIME CMD
1447 tty1          00:00:01 bash
About these ads

5 thoughts on “Linux – How to find out which Shell you are using?

  1. Wow that was strange. I just wrote an really
    long comment but after I clicked submit my comment didn’t show up. Grrrr… well I’m
    not writing all that over again. Regardless, just wanted to say
    wonderful blog!

  2. #! /bin/ksh
    echo $SHELL

    will still give me bash. How do I get the desired output in this case, i.e, ksh? I want to know the shell under which the process is running..

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s