Operation Systems

How to set bash as default shell in FreeBSD

If you have always used bash on your machines and now you have FreeBSD with default shell sh/csh this is an article how to change it with bash.

Firstly we have to install the bash shell. We can use the ports packat manager of FreeBSD. We can follow this 2 commands:

cd /usr/ports/shells/bash
make install clean

This has installed bash on your system and now you need to edit the account so you can set the bash shell as default for it. For example I will use the root account. You can edit the file located at /etc/passwd. You can use vi or some other text editor to edit this file. For example:

vi /etc/passwd

There should be a line that looks like this:

root:*:0:0:Charlie &:/root:/bin/sh
root:*:0:0:Charlie &:/root:/bin/csh

you should change this line to be like this:

root:*:0:0:Charlie &:/root:/usr/local/bin/bash

As you can see from the example above that we are just changing the path to the shell. That’s all. The path to the new shell is /usr/local/bin/bash.

Now after you have done these changes you can logout and login again with the same account and you will be using Bash shell.

Leave a Reply