AutoJump my most used shell utility
September 25, 2009 in releases by Barry Kukkuk
So the thing with developing in Linux is that you’re going to use the shell a lot. And the other thing with Linux is that most things are in a deep directory hierarchy. I find myself changing to different directories with long names a lot.
Even with tab-completion, it becomes really tiresome, and slows me down.
I know about pushd and popd which allows you to make a kind of directory “stack”. And it helps, but I don’t necessarily always go back in reverse order.
I’ve found this little utility called autojump. What it does is learn the directories that you use most often, assigning weights to the ones you use more frequently. So after a while of using the normal cd command, it has a pretty good idea of where you usually go.
Now you can jump to the directory you want, by issuing a very short command. For example:
cd ~/projects/MyProject/app/view/users
becomes
j users
And if there are a few directories you jump to with “users”, it will automatically go to the most-frequently used one. Or you can type j users and press Tab, which will give you a numbered list of all “users” directories in it’s list.
And the other kicker is that it’s case-insensitive.
Go, and be productive!
Wow! I sense AutoJump becoming most used shell utility too. Thanks a lot for sharing this, Barry!
@Walter: Yes, it becomes really useful once you’ve used it for a while.
Wow, this is great. I am trying it out.
I have been using apparix for a while, which is similar. It doesn’t try to remember your most-used directories, you add those yourself by typing ‘bm’ whenever you are in a place you want to return to. Later, you type ‘to’ and press tab and you get a list of places you can go immediately. It has some other advanced functions too, such as adding groups of subdirectories.
Looks like you can use apparix and autojump together if you like, which is probably what I will do.
My own fav but little known command line tool is wajig – it’s a unified command-line front-end for rpm, apt, etc. which works the same way no matter which distro you are currently on.