FreeBSD: Which Shell Am I Using? (How To Find Out)

Written by: Donovan / Last updated: Mar 20, 2022

Need to know which you’re using in FreeBSD?

It’s very easy to find out.

FreeBSD: Which shell am I using?

If you want to find out which shell you are currently using, you have a few options.

1. chsh

Just type in chsh.

You’ll get a text editor (likely vim) pop up with some lines of info about your user and default shell that looks like this:

#Changing user information for donovan.
Shell: /usr/local/bin/zsh
Full Name: Donovan Nagel
Office Location:
Office Phone:
Home Phone:
Other information:

You can see there that my default shell is zsh.

Note: This method will show you your default shell, but if you’ve opened a different one, it won’t tell you.

2. echo $SHELL / echo $0

In most cases, provided you have a $SHELL variable set (usually is by default), this will display your current shell.

Type echo $SHELL or echo $0 and you will get output like this: /usr/local/bin/zsh

3. ps -p $$

ps is used to show processes that are running.

This includes whatever shell is currently being used.

When you add -p $$, this tells ps to display the process of the current PID (your shell).

It should output something like this:

12978  4  Ss   0:00.08 /usr/local/bin/zsh

As you can see, my current shell is zsh.

4. /etc/passwd

Run this command:

cat /etc/passwd | grep user (replace user with your username)

It will return something like this:

donovan:*:1001:1001:Donovan Nagel:/home/donovan:/usr/local/bin/zsh

As you can see, it shows this user’s default shell.

View Archive