So Just What is Bashrc
Posted: January 15, 2008 Filed under: NEZzen Leave a comment »You’re most likely using it without even knowing, but .bashrc is a script in your home directory that gets executed every time you start a shell. You’ve most likely updated this file if you have ever wanted an alias to be created (like to enable colors when running ls), or an environment variable to be altered (for example, appending something to PATH) for each instance of bash you start.
Included in most Linux distributions are both .bash_profile and .bashrc. The difference between the two is that .bash_profile is executed for “login shells” (when you login at a TTY or RSH/SSH/Telnet session), while .bashrc is executed for interactive non-login shell (ie. starting a shell from within another program or by /bin/bash). There is also a related file that executed on logout called .bash_logout.
Typically, most people will probably never remember the difference between the two files, and normally it does not matter because they are generally set up so that one will call the other. If not, you can prepend the following lines to your .bash_profile:
if [ -f ~/.bashrc ]; then source ~/.bashrc fi
This should finally clears up for everyone! And don’t forget to check your man pages for more information.