# add these to your .bash_profile

# title sets your terminal tab's title to any string you pass in.
# from http://stackoverflow.com/a/1687708
function title() { echo -n -e "\033]0;$@\007";} 

# cd modifies the cd command and uses title to set it to whatever the current dir is.
# from http://superuser.com/a/296555
function cd() { builtin cd "$@" && title ${PWD##*/}; } 

# Confirmation that title() works on a mac came from a book called "Mac OSX for Unix Geeks" on Google books.