How To Get Shell Type and Version In Linux? – POFTUT

How To Get Shell Type and Version In Linux?


While using remote sessions we may need to know the type and version of the remote shell. Bash is popular but there may be different shells like sh, csh, ksh etc.

Using $SHELL Variable

Shells provide environment variables to give information about the shell and the environment. $SHELLenvironment variable can be used to get current she type. $SHELL variable information is not so reliable.

$ echo $SHELL 
/bin/bash

We can see that our current shell is bash

Using ps Command

We can use ps command with some parameters to get shell information like below.

$ ps -p $$ 
  PID TTY          TIME CMD 
 3380 pts/8    00:00:00 bash
  • We use ps command by providing the current process
Using Ps Command
Using Ps Command

LEARN MORE  Pgrep and Pkill Command Tutorial With Examples For Linux

Leave a Comment