Unix Setup

From Mavaball

Jump to: navigation, search

This page contains notes that may be useful for setting up their environment on a Unix-like system, such as Linux, Mac OS, or Cygwin,

Bash Setup

This section describes some recommendations for setting up the bash terminal.

.bash_profile

The ~/.bash_profile configuration file is sourced whenever you run a log-in terminal (which somewhat surprisingly doesn't happen by default with gnome-terminal). This file should be used to set up the environment for an interactive bash session.

Example ~/.bash_profile:

export PS1='\n\[\033[01;32m\]\u\[\033[01;36m\]@\[\033[01;32m\]\h\[\033[01;34m\] [\t] \[\033[01;33m\]\w\n$\[\033[00m\] '

case `uname` in
    Linux)
        alias ls='ls --color=auto'
        ;;
    Darwin)
        alias ls='ls -G'
        ;;
esac

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

# Change the window title of X terminals
case ${TERM} in
        xterm*|rxvt*|Eterm|aterm|kterm|gnome)
                export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
                ;;
        screen)
                export PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"'
                ;;
esac

# show the load average, among other things
uptime

echo "Ran ~/.bash_profile"