What is a .bashrc file and what does it do?
Solution 1:
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.