Which shell I am using in mac

macOS's Terminal allows you to specify the shell in its preferences. By default, it is set to use your login shell, but it looks like you've overridden it to use Bash.

In the General tab of Terminal's preferences, set it to "Default login shell," to prevent your login shell from being overridden:

Terminal's settings

Also, make sure the "Run command" checkbox is not checked in the Shell tab of your profiles' settings:

Profile settings


To see what shell is currently running - which may or may not be your default shell - use:

# Prints something like '/bin/ksh' or '-zsh'
# See bottom section if you always need the full path.
ps -o comm= $$

The above assumes that the running shell is a POSIX-compatible shell. If the running shell is PowerShell, replace $$ with $PID, which will tell you the full path even if PowerShell is also the default shell. If you use
(Get-Process -Id $PID).Path instead, you'll get the full path with symlinks resolved, if any.

To see what shell is your default shell, run:

echo $SHELL

If the currently running shell is PowerShell: $env:SHELL


If you need to know the full path of the currently running shell:

If the current shell was launched directly by Terminal.app (or iTerm2), it is a login shell launched via the login utility, which causes the current shell process to self-report its binary abstractly as -<binary-filename>, e.g. -zsh; that is, you don't get the full path of the binary underlying the shell process.

If always obtaining the full path is required - e.g. if you want to distinguish the system Bash /bin/bash from a later version installed via Homebrew - you can use the following command line:

(bin="$(ps -o comm= $$)"; expr "$bin" : '\(-\)' >/dev/null && bin="$(ps -o command= $PPID | grep -Eo ' SHELL=[^ ]+' | cut -f 2- -d =)"; [ -n "$bin" ] && echo "$bin" || echo "$SHELL")