PUBLISHED: August 22, 2019
Deprecation Notice: This article was written more than a year ago which means that its information might no longer be
up-to-date. We cannot therefore guarantee the accuracy of it's contents.
Table of Contents
How to find out which shell I am running?
There are many different shells available on Linux based systems: bash, zsh, tcsh, csh, just to name a few. So how do we find out which shell we are currently in?
The echo command
Simple, we just execute a one-liner. As always, the first dollar $ symbol should be omitted because it is only a prompt indicating that we are logged in as a regular user.
$ echo $0
This gives us the following output which shows that we are in a bash shell.
-bash
The ps command
As always, there is more than one way to do the same thing in Linux:
$ ps -p $$
The ps command gives us slightly more output but it is still very easy to see which shell you are in.
PID TTY TIME CMD
27848 ttys002 0:01.72 -bash
Further Information
For further information on either the echo or ps commands, type:
$ man echo
...
$ man ps
...
comments powered by Disqus