LinuxCommandLibrary

autojump

Quickly jump to frequently used directories

TLDR

Add the autojump aliases to your shell

$ source /usr/share/autojump/autojump.[bash|fish|zsh]
copy

Jump to a directory that contains the given pattern
$ j [pattern]
copy

Jump to a sub-directory (child) of the current directory that contains the given pattern
$ jc [pattern]
copy

Open a directory that contains the given pattern in the operating system file manager
$ jo [pattern]
copy

Remove non-existing directories from the autojump database
$ j --purge
copy

Show the entries in the autojump database
$ j [[-s|--stat]]
copy

SYNOPSIS

j [directory fragment]

PARAMETERS

j [directory fragment]
    Jumps to the best-matching directory based on the given fragment. Fuzzy matching is used, so exact spelling is not always required.

jo [directory]
    Opens a file manager (like Nautilus, Finder, etc.) in the specified directory. This requires that a suitable file manager is configured for use with xdg-open.

jc [directory fragment]
    Jumps to the best matching directory as j command but only includes subdirectories of the current directory.

jco [directory]
    Opens the specified directory in a file manager (similar to `jo`), including only subdirectories of the current directory

j --stat
    Displays the current autojump database statistics including the ranked directories.

j --help
    Displays the help message.

DESCRIPTION

Autojump is a command-line tool designed to provide faster directory navigation.
It works by maintaining a database of the directories you frequently visit. Instead of typing long paths or repeatedly using 'cd', you can 'j' to a directory. Autojump learns from your habits, prioritizing directories you visit more often.
The command's usefulness stems from its fuzzy matching capability. For example, `j doc` will jump to the most relevant directory containing 'doc' in its path.
Autojump improves shell efficiency significantly, particularly for users who work with many deeply nested or scattered directories. It needs a shell plugin to work and is available for most of the shells. Autojump supports weighting in the jumps to provide an efficient fuzzy matching approach and weighting in the directories.

CAVEATS

Autojump requires installation and configuration of the shell plugin. The database needs to be updated as you move between directories in the shell to keep accurate statistics of your habits.

INSTALLATION

Installation is typically done through your distribution's package manager (e.g., `apt-get install autojump` on Debian/Ubuntu, `brew install autojump` on macOS with Homebrew). After installation, you *must* add the appropriate line to your shell's configuration file (e.g., `~/.bashrc`, `~/.zshrc`) to source the autojump plugin. The exact line is provided in autojump's documentation or upon install.

DATABASE MAINTENANCE

Autojump automatically maintains its database. To manually rebuild the database, you can use `autojump --purge` followed by navigating to the directories you wish to add.

HISTORY

Autojump was originally inspired by the 'autojump' script written by Joël Schaerer.
The command gained traction in the open-source community due to its effective navigation capabilities. Its popularity led to it being included in many Linux distribution repositories and MacOS.

SEE ALSO

cd(1), pushd(1), dirs(1), popd(1)

Copied to clipboard