When working in Ubuntu or OS X there always comes a time when you run across something that requires using Terminal. Terminal is an application that emulates the terminal interface from the days of olde and is also referred to as the terminal window. This interface is extremely useful, in fact some users prefer Terminal versions of programs to using a GUI.

Customizing the Terminal (Bash Shell) is simple and improve your experience. You will need to create a file to store your settings. In both OS X and Ubuntu this file will be stored in your home directory (/Users/kc or /home/kc in my case). OS X looks for a file called .bash_profile, and .bashrc in Ubuntu.

The most interesting task that my .bash_profile (.bashrc) file performs is displaying the current directory. Above the current line, the active directory is displayed in blue text surrounded by square brakets. This allows a quick check to verify that you are in the correct directory before entering commands.

Below is my current file and a screenshot of the results.

################################## # Casey Robinson's .bash_profile # Last Modified: 1 July 2011 # Running on OS X 10.6.8 ################################## #Exports ################################# PATH=$PATH:/usr/lib/festival/ ;export PATH export PS1="[\[\033[1;34m\w\e[0m]\n[\t \u]$ " export EDITOR=/usr/bin/pico export HISTFILESIZE=3000 # the bash history should save 3000 commands export HISTCONTROL=ignoredups #don't put duplicate lines in the history. alias hist='history | grep $1' #Requires one input # Define a few Color's BLACK='\e[0;30m' BLUE='\e[0;34m' GREEN='\e[0;32m' CYAN='\e[0;36m' RED='\e[0;31m' PURPLE='\e[0;35m' BROWN='\e[0;33m' LIGHTGRAY='\e[0;37m' DARKGRAY='\e[1;30m' LIGHTBLUE='\e[1;34m' LIGHTGREEN='\e[1;32m' LIGHTCYAN='\e[1;36m' LIGHTRED='\e[1;31m' LIGHTPURPLE='\e[1;35m' YELLOW='\e[1;33m' WHITE='\e[1;37m' NC='\e[0m' # No Color #Modified Commands ################################# # Alias to multiple ls commands alias la='ls -Al' # show hidden files alias lk='ls -lSr' # sort by size alias lc='ls -lcr' # sort by change time alias lu='ls -lur' # sort by access time alias lr='ls -lR' # recursive ls alias lt='ls -ltr' # sort by date alias lm='ls -al |more' # pipe through 'more'