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

[email protected]:~/$ cd /etc

[email protected]:/etc$ cd -

[email protected]:~/$ cd -

[email protected]:/etc$ ‚Äč

Michael is a polyglot software engineer, committed to reducing complexity in systems and making them more predictable. Working with a variety of languages and tools, he shares his technical expertise to audiences all around the world at user groups and conferences. You can follow @mheap on Twitter

Thoughts on this post

Leave a comment?

Leave a Reply