If you’re a Unix geek, you’ve probably used bash, the Bourne-Again Shell. If you’ve been around a while, you’ve probably spent a lot of time customizing bash.
Back when I worked for Yahoo!, my friend Bryan gave me a great directory stack for bash. I loved it, so I rewrote it and have been hacking on it and using it ever since. Observe.
[user@host:~]$ cd /tmp [user@host:/tmp]$ cd /var/log [user@host:/var/log]$ dl 1 ~ 2 /tmp 3 * /var/log [user@host:/var/log]$ go 1 1 /home/user [user@host:~]$ go log 3 /var/log [user@host:/var/log]$ |
In addition to the handy new go
command, it also includes b
and f
for moving backwards and forwards on the stack. It was inspired by pushd
and popd
, but it’s so much more.
If you’d like to check it out, take a look at my bashtools repository on GitHub or just download version 1.0. I don’t change it very often, but I’m thinking of hammering out a long-standing bug in the directory stack code.
N.B. If you use all of my scripts, you’ll get some great prompts for your xterms. You’re welcome!