joelthelion / autojump

A cd command that learns - easily navigate directories from the command line

Home | Edit | New

Home

Autojump: a cd command that learns

One of the most used shell commands is “cd”. A quick survey among my friends revealed that between 10 and 20% of all commands they type are actually cd commands! Unfortunately, jumping from one part of your system to another with cd requires to enter almost the full path, which isn’t very practical and requires a lot of keystrokes.

autojump is a faster way to navigate your filesystem. It works by maintaining a database of the directories you use the most from the command line. The jumpstat command shows you the current contents of the database. You need to work a little bit before the database becomes usable. Autojump will listen and rank your ‘cd’ commands by frequency. Once your database is reasonably complete, you can “jump” to a commonly "cd"ed directory by typing:

j dirspec

where dirspec is a few characters of the directory you want to jump to. It will jump to the most used directory whose name matches the pattern given in dirspec.

Autojump supports tab-completion. Try it! Autojump should be compatible with Bash 4 and zsh. Please report any problems!

Pierre Gueth contributed a very nice applet for freedesktop desktops (Gnome/KDE/…). It is called “jumpapplet”, try it!
Thanks to Simon Marache-Francisco’s outstanding work, autojump now works perfectly with zsh.

EXAMPLES

j mp3

could jump to “/home/gwb/my mp3 collection”, if that is the directory in which you keep your mp3s.

jumpstat

will print out something in the lines of:

… 54.5: /home/shared/musique 60.0: /home/joel/workspace/coolstuff/glandu 83.0: /home/joel/workspace/abs_user/autojump 96.9: /home/joel/workspace/autojump 141.8: /home/joel/workspace/vv 161.7: /home/joel Total key weight: 1077

The “key weight” reflects the amount of time you spend in a directory.

DOWNLOAD

Use the github dowloads to get the latest release, or use git to get the bleeding edge version (should usually work)

INSTALLATION

For automatic installation, make sure that install.sh is executable. If not (or if not sure), run

chmod +x install.sh

Once it is executable, run

./install.sh
It will tell you any necessary steps from there.

Manual installation of autojump is very simple: copy autojump to /usr/bin, autojump.sh to /etc/profile.d, and autojump.1 to /usr/share/man/man1. Make sure you source /etc/profile in your .bashrc:

source /etc/profile

AUTHORS

Joel Schaerer (joel.schaerer (at) laposte.net) <— don’t hesitate to send feedback!
Autojump applet written by Pierre Gueth
Zsh support: Simon Marache-Francisco
Install script written by Daniel Jackoway and others.

LICENSE

autojump is distributed under the terms of the GPL, version 3.

PACKAGING

For now I have packaged autojump for arch linux. It is available from the AUR. To install, type:

yaourt -S autojump

I would be very interested by pacakges for other distros. If you think you can help me with the packaging, please contact me! Note that apart from bash(zsh) and python, autojump doesn’t have any dependencies.

Last edited by joelthelion, Mon Nov 23 17:28:33 -0800 2009
Home | Edit | New
Versions: