Ubuntu – a .bashrc file and what does it do


I can't seem to find any clear information on what the .bashrc file is and what it does exactly.

Thanks for all the help so far. It seems that this script does everything from coloring, completion, aliases and shell history, etc. Is there anything that does not seem useful?

Best Answer

The .bashrc file is a script that is executed whenever a new terminal session is started in interactive mode. This is what happens when you open a new terminal window by pressing Ctrl+Alt+T, or just open a new terminal tab.

By contrast a terminal session in login mode will ask you for user name and password and execute the ~/.bash_profile script. This is what takes place, for instance, when you log on to a remote system through SSH.

The .bashrc file itself contains a series of configurations for the terminal session. This includes setting up or enabling: colouring, completion, the shell history, command aliases and more. The .bashrc file distributed with Ubuntu is well commented and you will be able to understand most of what it does just by reading it.

You can tweak .bashrc to your liking. Here you can get an example with many extra features.

Related Question