cd -

A short one today. In keeping with the moving around theme from yesterday, I want to take a look at cd -. cd - means "take me back to the last directory I was in".

So, starting in ~/theunixtoolbox.com, and running cd /etc would take us to /etc. Running cd - would take us back to ~/theunixtoolbox.com and running cd - again would take us back to /etc.


vagrant@precise64:~/theunixtoolbox.com$ cd /etc

vagrant@precise64:/etc$ cd -
/home/vagrant/theunixtoolbox.com

vagrant@precise64:~/theunixtoolbox.com$ cd -
/etc

vagrant@precise64:/etc$ ‚Äč
comments powered by Disqus