September 22, 2012

Directory history for your shell

Bash’s directory stack is great but incomplete:

What if your browser didn’t have a forward button, only a back button?

Your browser lets you go back after you navigate somewhere, and forward again if you change your mind. Bash doesn’t do either. The pushd and popd builtins give you a back button but no forward button. I fixed all that:

$ cd foo
$ cd ../bar
$ b
$ f

It’s a set of Bash functions. You can find them on GitHub right here. Let me know if it’s useful or if you have any suggestions on how to make it even awesomer.