[SHELL] How to know in which shell you are working in Linux or FreeBSD
 

[SHELL] How to know in which shell you are working in Linux or FreeBSD

 

There are several ways to know the current shell on which you are working. We will be using some shell commands to know in which Shell you are working on.

#1 To know Which Shell you are working on:
The easiest way is by entering the following command in the shell itself:

    $ ps -p $$

Explanation:
Basically we are listing the process (by using the ps command) by process ID (the -p option to ps command) of the current process, which is the shell ($$). The ps command will report the PID of the current process and the name of the process.

#2 To know Which Shell you are working on:
You can also know the working shell by entering the following command in the shell itself:

    $ echo $SHELL

This will give you the path to the current shell that you are using. Basically SHELL is a environment variable set when you run the command line or the Shell. This method may not work in some shells if the particular shell is not setting this variable.

If you know other ways to get the current shell then you are most welcome to share your knowledge.

Previous How to Download, Extract and update the Linux Kernel source
Next [VIM] Removing new line at the End Of File in VIM
 

About author

shibaa987
shibaa987 274 posts

Linux kernel developer and a firmware developer with an experience of 10+ years.

View all posts by this author →

You might also like

Linux Topics 0 Comments

How To Setup GNOME GUI On CentOS 8?

GNOME is a free and opensource desktop environment for Unix-like operating systems. It is a user-friendly desktop environment and comes default in various distributions such as Ubuntu, Debian, Fedora, etc.

Linux Topics 0 Comments

How To Check Uptime Of A Linux Server?

This post was last updated on August 1st, 2020 at 12:15 pmSystem uptime is how long a system has been up and running. Linux operating system provides various commands such

Linux Topics 0 Comments

How to Unload or Blacklist Module in Linux

This post was last updated on January 22nd, 2019 at 11:06 amSometimes you need to unload a kernel module to load your own written code or you want to replace

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply