Faster File Navigation with autojump
Updated by Sam Foo Written by Sam Foo
What is autojump?
autojump is a command line utility similar to
cd. It helps speeds up file navigation by maintaining a history of directories that have been previously navigated by the user. If there are directories with the same name,
autojump maintains a weighted history to favor the most frequently accessed directory.
This guide will cover installation on Linux and MacOS. Support for Windows is limited.
sudo apt install autojump
On Debian-based distros, manual activation is required. Add the following line to
~/.bashrc(for Bash) or
~/.zshrc(if you use zsh):
More information is available in the README:
yum install autojump
For shell specific installation, use
autojump-zsh for zsh and
autojump-fish for fish.
The recommended installation method is to use Homebrew:
brew install autojump
Be sure to follow the instructions and add the line from installation into the corresponding configuration file. If using
autojump as a plugin.
Add the following line to your ~/.bash_profile or ~/.zshrc file (and remember to source the file to update your current session): [[ -s `brew --prefix`/etc/autojump.sh ]] && . `brew --prefix`/etc/autojump.sh
Install autojump via Python
Ensure that git is installed, navigate to the directory where autojump should be installed, then clone the autojump repo:
git clone git://github.com/joelthelion/autojump.git
Run the install script:
cd autojump/ ./install.py
Noteautojump supports Python 2.6+, with the exception of 3.2.
How to Use autojump
j are equivalent for most purposes.
j is preferred for convenience.
Before jumping to any directory, check the weights of the installation:
Since no directories have been visited since installation, the total weight is 0.
________________________________________ 0: total weight 0: number of entries 0.00: current directory weight data: /Users/linode/Library/autojump/autojump.txt
Create an example directory and child. Visit each directory then navigate back to home.
mkdir -p foo/bar/ mkdir -p fuu/bar/ cd foo/ cd bar/ cd ~ cd fuu/ cd bar/ cd ~
j -sagain. The new weights should be reflected in the results:
10.0: /Users/linode/foo 10.0: /Users/linode/foo/bar 10.0: /Users/linode/fuu/bar 10.0: /Users/linode/fuu ________________________________________ 40: total weight 4: number of entries 0.00: current directory weight data: /Users/linode/Library/autojump/autojump.txt
A more comprehensive description of the arguments can be found with:
Jump to a Directory
Jump to a directory:
Jump to a Child Directory
Jumping to a child with
c is supported:
Jump with Multiple Arguments
Multiple arguments can be used with partial names of the full path.
j fu bar
Open Using File Manager
o command opens the file manager and can also be used in conjunction with
Purge Deleted Directories from autojump
When a directory is deleted, its weights remain in autojump’s records. You should regularly purge these weights to prevent autojump from navigating to nonexistent directories.
Navigate to the home directory and delete the
cd ~ rm -rf foo/
Purge the deleted directory from autojump:
autojumpcan only be used to jump to directories that have been visited after installation. If you attempt to jump to a directory not yet visited,
Visit the directory before attempting to jump.
oh-my-zsh, opening a new Z shell causes the following error:
/Users/linode/.rvm/scripts/initialize:48: __rvm_cleanse_variables: function definition file not found /Users/linode/.rvm/scripts/initialize:50: command not found: rvm_error
autojumpis added as a plugin in
.zshrcthen remove all
You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.
Join our Community
This guide is published under a CC BY-ND 4.0 license.