I was always worried about having to go up in a unix directory tree with cd ../. Then I was introduced to this project at work where I noticed that I was doing so much cd-ing around. Sometimes I went so deep in the directory tree I had this scary feeling inside that I’d get lost in a dark pit (true story).
I wanted a better way to do it. So I did what anyone these days would do. But the best the internet could offer were using pusd/popd, aliasing multiple ../s to ..n and using CDPATH. None of these felt natural enough.
So on one boring evening at work I started to scratch my own itch. I started to do it in python but I ended up in a simpler, much better solution. A function for my bashrc.
I call it za because …
you can use za to jumpback any number of directories up to your $HOME directory. Just put the following function in your .bashrc
za 2 #will jump 2 directories up
za #will jump one directory up
Just see it in action.
Hope you find it useful.
PS: My blog marked 6 years to yesterday (8th August 2012). I’m out of (a year?) long block with this post :)