Archive for October 22nd, 2010

Oct 22 2010

Mac Command Line Tricks

Published by under Code

Mac OS XI’ve slowly been moving over to a new MacBook Pro and trying to learn a new system. One of the things I’ve never given up from my Unix days is the command line. Even on my Windows PC, I have tcsh installed, which is my normal way of navigating through my files.

One of the “must have” hacks for my terminal window is getting the current path into the title and customizing the prompt.  With a bit of Google-fu, I was able to figure out the command sequences to do this.  Just add the code below to your


To set the title of a Mac Terminal Window:

function settitle() { echo -ne "\033]0;$@\007"; }
function cd() { command cd "$@"; settitle `pwd -P`; }
settitle `pwd`

To set the command prompt so that it displays the current directory name with the history number of the command:


No responses yet