The single most timesaving bash shortcut

github logo ・1 min read

It is a bit of embarrassing but I spent 10 years in my field without knowing the

cd -,git checkout/merge -


The -references the last folder/branch you accessed. So this is a thing:

$ pwd

$ cd test
$ pwd        

$ cd -
$ pwd

Probably the biggest revelation I ever had once a colleague of mine told me.

twitter logo DISCUSS (3)
markdown guide

That one I actually knew before :) But yeah, especially in scripts pushd and popd are awesome.


Ah yes, the - shortcut, the "back button" of bash! 😄

Classic DEV Post from Nov 17 '18

DenverCoder9 and the future of DEV

As DEV grows in popularity, it's really exciting to see folks finding community...

Kai Timmer profile image
Site Reliability Engineer Chapter Lead Care about all kinds of things