How can I tell which Unix shell I am using?
LinuxShellUnixLinux Problem Overview
Linux Solutions
Solution 1 - Linux
Try:
echo $0
This often works across a range of shells.
Solution 2 - Linux
Mac
ps
PID TTY TIME CMD
223 ttys000 0:00.33 -bash
OpenBSD
ps
PID TT STAT TIME COMMAND
20038 p0 Ss 0:00.01 -ksh (ksh)
22251 p0 R+ 0:00.00 ps
Or just echo $SHELL
.
Solution 3 - Linux
The echo $SHELL
command will give you your shell name relative to root.
Solution 4 - Linux
Every shell I know of sets the $ variable ($$) to its pid. So...
ps | grep $$
Solution 5 - Linux
If you are using the OS X terminal, then the shell is specified in the Terminal's title bar when you launch it - like so: Terminal - ShellName - 80x24