Breadcrumbs 
Learning >> Documentation >> Configuring the Shell >> Bash config files
 
Recent News
We're No 1!
We've reached the top! (Of Google!)
[ more ]
Firefox 3 Download Day
Firefox 3 has been officially released and is looking to set a world record for the most downloaded piece of software in 24hrs.
[ more ]
SSL Renewed
SSL cert has been renewed by the admin team.
[ more ]
Bash config files
Bash config files

Bash (your shell) reads several config files on startup.

It first reads and executes commands from the file /etc/profile, if that file exists. The idea behind this file is to easily facilitate system wide configuration changes by administrators.

After reading that file, it looks in the user's home directory (where you are when you log on) for the hidden files .bash_profile (which then executes .bashrc), .bash_login, and .profile, in that order, and reads and executes commands from the first one that exists and is readable.

Files preceded by a period '.' are hidden to the usual 'ls'. To show all these hidden files you will have to run:

$ ls -a

For more information on this see Listing files.

So what does each of these files do? Well the general idea is:

  • Personal envrionment variables and startup programs go in ~/.bash_profile
  • Personal aliases and functions should go in ~/.bashrc
  • System wide aliases and functions are in /etc/bashrc
  • System wide environment variables and startup programs are in /etc/profile

To edit any of the options described in this document, edit that file (e.g. nano .bashrc). Next we'll look at command aliases.