English English

Set bash as the default shell for FreeBSD

Bash is a popular shell that is available also on Linux distros. If you are more familiar with the bash shell and would prefer to use that as your default shell, you can make that adjustment in a few short steps.

Note: bash is not supported on FreeBSD 11.1, and the instructions in this section will not work for that particular version.

First, you need to install the bash shell by typing:

    sudo pkg install bash 

You will be prompted to confirm that you want to download the package. Do so by pressing y and then ENTER.

After the installation is complete, you can start bash by running:


This will update your shell prompt to look like this:

To change freebsd's default shell to bash, you can type:

sudo chsh -s /usr/local/bin/bash freebsd 

The next time you log in, the bash shell will be started automatically instead of the current default.

If you wish to change the default pager or editor in the bash shell, you can do so in a file called ~/.bash_profile. This will not exist by default, so you will need to create it:

ee ~/.bash_profile 

Inside, to change the default pager or editor, add your selections like this:

export PAGER=less
export EDITOR=ee

Save and close the file when you are finished by pressing CTRL+C, typing exit, and then pressing ENTER.

To implement your changes immediately, source the file:

source ~/.bash_profile 

If you'd like to make further changes to your shell environment, like setting up special command aliases or setting environment variables, you can reopen that file and add your new changes to it.

Cookies erleichtern die Bereitstellung unserer Dienste. Mit der Nutzung unserer Dienste erklären Sie sich damit einverstanden, dass wir Cookies verwenden.