Glass Onion Blog

Cheat sheets, post-its and random notes from the desk of a programmer

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

Posted by walrus on July 21, 2008

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

One Response to “Linux – How to find out which Shell you are using?”

  1. anshprat said

    #! /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

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>