[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

Sibananda Sahu
Sibananda Sahu 136 posts

A Linux Kernel Developer and a Firmware Developer by profession. Have worked with few big companies: BROADCOM Corporation, Cypress Semiconductor, LSI Corporation, TOSHIBA Corporation, Western Digital; on various cutting edge technologies and product lines, such as: RAID storage Driver, SSD Firmware, WLAN Firmware etc. Having more than 9 years of experience in Software Engineering domain. Now, took a pledge to educate all aspirant students to teach about Linux Kernel Development.

View all posts by this author →

You might also like

Linux Topics 0 Comments

How To Use dd command In Linux/Unix To Make USB Bootable?

This post was last updated on May 2nd, 2020 at 10:08 amDD command is used to create a bootable disk from an existing image as it clones data from one

Linux Topics 0 Comments

How to Print files in Linux Using Command Line

Printing a file is one of the basic functionalities provide by the linux operating system, rather than just printing a file its provides us with a variety of options like

Linux Topics 0 Comments

How To Add/Remove New User In Linux/Unix

This post was last updated on September 14th, 2019 at 07:22 amIn this article, we will learn to add or remove users and giving them required permissions in Linux or

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply