Installing the BASH Shell on FreeBSD

By default, FreeBSD does not come with the bash shell pre-installed like on most Linux distributions. To install it, run the following commands:

pkg install bash
mount -t fdescfs fdesc /dev/fd
echo "fdesc    /dev/fd        fdescfs        rw    0    0" >> /etc/fstab

You can also change the default shell to bash but before you do, remember to log out of root.

Note: Do not change the default shell of the root user.

To change the default shell to bash, run the following command:

chsh -s /usr/local/bin/bash

You will have to log out and then log back in for the changes to take effect.

To customize the shell further, create the .Xdefaults in your home directory with the following lines:

xterm*Background:    black
xterm*Foreground:    white

and create a .bashrc file also in your home directory with the following line:

alias ls='ls -G'

which invokes a color display when using the ls command. In order for FreeBSD to see this .bashrc file, you will need to create a .bash_profile file, also in your home directory, with the following line:

source ~/.bashrc


Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License