determine which shell is currently running

2019-12-03

 | 

~1 min read

 | 

79 words

If you switch between shells, it might be handy to determine which one is currently running.

One way to do that is to check your process status (ps utility).

To find the process id (PID) of the current instance of your shell, use:

echo "$$"

You can then pass this into the ps utility to find a specific PID with the -p flag:

$ ps -p "$$"
  PID TTY           TIME CMD
21373 ttys001    0:00.69 -zsh

Related Posts
  • Changing the default shell to zsh


  • Hi there and thanks for reading! My name's Stephen. I live in Chicago with my wife, Kate, and dog, Finn. Want more? See about and get in touch!