December 03, 2019
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 (
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
$ ps -p "$$" PID TTY TIME CMD 21373 ttys001 0:00.69 -zsh
Thanks for reading! My name's Stephen Weiss. I live in Chicago with my wife, Kate, and dog, Finn.
Click here to see the archives of my weeks in review and sign up yourself!