cd –

This article was published 6 years ago. Due to the rapidly evolving world of technology, some concepts may no longer be applicable.

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 ~/michaelheap.com, and running cd /etc would take us to /etc. Running cd - would
take us back to ~/michaelheap.com and running cd - again would take us back to /etc.

[email protected]:~/michaelheap.com$ cd /etc

[email protected]:/etc$ cd -
/home/vagrant/michaelheap.com

[email protected]:~/michaelheap.com$ cd -
/etc

[email protected]:/etc$ ‚Äč

Thoughts on this post

Leave a comment?

Leave a Reply