Basic Bash Configuration Files
From UMaine Supercomputer
Contents |
Introduction
Your shell environment can be personalized using files in your home directory. In general you should have at least a very basic configuration file so that your shell works on all our machines.
For the bash shell (the default) this is done by two files in your home directory ( .bash_profile and .bashrc ). Note the period at he start of each name. Normally these are hidden to ls, but if you type ls -a you will see them. Normally, the .bash_profile file is read by a login shell (when you log in) and the .bashrc is read by non-interactive shells (such as when you do a one line ssh command to a node).
Below are examples of very basic files.
The same structure is available for the other popular shell, tcsh, but you will need to build our own files.
.bashrc
# .bashrc
# User specific aliases and functions
source /etc/profile
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
Various Tips
- Color output for ls
UNAME=`uname` if [ "$UNAME" == "Linux" ]; then alias ls='ls --color=auto' fi if [ "$UNAME" == "Darwin" ]; then export TERM=xterm-color alias ls='ls -G' fi

