last dir

Shell (~bash) - OS X, Windows, Linux

Change to your previous directory using the special directory marker -.

> pwd
>> /Users/jcfuller/Downloads
> cd /Users/jcfuller/dev/github
> pwd
>> /Users/jcfuller/dev/github
> cd -
> pwd
>> /Users/jcfuller/Downloads

I use this quite a bit when I need to run a command from a specific directory, but then want to get right back to where I was.

Published: June 20 2012

Author: jonfuller