Don’t bother you anymore about Bash Configuration on Linux and Mac

June 3rd, 2011 by Regaz

Turn out than users than are not very Experts of Unix like administration when think about bash configuration often have an unresolved question in their minds:
What the difference between .bashrc, .bashrc and .profile?


.profile is a System configuration file and is read only on a bash login
.bashrc is a Bash configuration file and is read only on a bash login
.basrc is read at every new bash Terminal’s session (when you open a new Terminal’s Tab or Window)

So if you need to Insert new Settings to be ready for the Next Terminal’s Session you need Definitely Insert Statements on .bashrc

First of all it should be made clear than Bash configuration files doesn’t work if you open a not Bash session in Terminal. I mean if you open a new terminal window in sh or ksh the bash’s configuration for a new Terminal’s session than are stored in .bashrc don’t will be activated.
For to have your settings working on every kind of session you should put your settings directly on .profile.
Instead if you are in some Unix like system and you want than your Bash configuration should work you need to set Terminal to Execute a /bin/bash command when Starting up.
In a Mac for example you should go in Terminal -> Preferences -> Settings and after to have selected your Default Profile select in the little navigation Shell. Once here you need to check Run command and insert the /bin/bash. So you will be sure than the configuration than you have made will be working the next time you will open a Terminal’ session.

The command to start Terminal on Bash should been already present on Linux systems, but for to check that you can go in Preferences and to look than in Command there is /bin/bash.

Now to resolve the problem of where to put the Configuration’s statements for Bash you should open your .bashrc and insert a call the other existing configuration’s file:

pico .bashrc

if [ -f ~/.bashrc ];
then
source ~/.bashrc
fi

Make it Crystal Clear…
You will Shine at best! :)

Tags: , , , , ,