Alex Biddle     About     Archive     Feed

How to install autojump on Ubuntu

Autojump is a bash enhancement that makes directory traversal easier. Over time, it remembers directories that you have visited and allows you to “jump” to directories using partial directory names.

alex@monolith:~$ cd ~/dev/alexbiddle.github.io/
alex@monolith:~/dev/alexbiddle.github.io$ cd ~
alex@monolith:~$ j alex
/home/alex/dev/alexbiddle.github.io
alex@monolith:~/dev/alexbiddle.github.io$ 

You can install it using

sudo apt-get install autojump

However there is no post-installation hook to make it work with bash. A look inside the package shows us what we need to include:

alex@monolith:~$ dpkg -L autojump
/.
/usr
/usr/share
/usr/share/zsh
/usr/share/zsh/functions
/usr/share/zsh/functions/Completion
/usr/share/zsh/functions/Completion/Unix
/usr/share/zsh/functions/Completion/Unix/_j
/usr/share/autojump
/usr/share/autojump/autojump.zsh
/usr/share/autojump/autojump.sh
/usr/share/autojump/autojump_data.py
/usr/share/autojump/autojump_argparse.py
/usr/share/autojump/autojump
/usr/share/autojump/autojump.fish
/usr/share/autojump/autojump_utils.py
/usr/share/autojump/autojump.bash

So let’s add it to bashrc:

echo ". /usr/share/autojump/autojump.bash" >> ~/.bashrc

Open up a new bash tab, visit some directories, then you should be able to use the j-command.