Operations 8 min read

Speed Up Linux Directory Navigation with autojump: Install and Master Its Commands

This guide explains how to install the autojump tool on Linux, configure it, and use its various commands and options to quickly jump to frequently visited directories, including tips on weight management, tab completion, and handling common limitations.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Speed Up Linux Directory Navigation with autojump: Install and Master Its Commands

The autojump utility speeds up directory navigation in a Linux terminal by recording directories you visit with cd and assigning usage‑based weights. Commands can then jump to those directories using short keywords.

Prerequisites

Python 2.6+ or Python 3.3+ must be available. The example assumes a CentOS 7.5 system with Python 2 installed. If Python is missing, a provided script can install Python 3 from two tar packages placed in the same directory:

sh python3_install.sh

Installation

Download the source archive from the official GitHub repository and unzip it.

unzip autojump-master.zip
cd autojump-master
./install.py   # or ./uninstall.py

The installer appends a line to ~/.bashrc that sources the autojump script. If the line is not added, manually insert the following and reload the shell:

[[ -s /root/.autojump/etc/profile.d/autojump.sh ]] && source /root/.autojump/etc/profile.d/autojump.sh
source ~/.bashrc

Verify the installation:

autojump --version   # or j -v

Command syntax

autojump [-h] [-a DIRECTORY] [-i [WEIGHT]] [-d [WEIGHT]] [--complete] [--purge] [-s] [-v] [DIRECTORY ...]
-h

: show help and exit -a DIRECTORY: manually add a path to the database -i [WEIGHT]: increase the weight of the current directory -d [WEIGHT]: decrease the weight of the current directory --complete: enable tab‑completion (also corrects misspellings and adds underscores) --purge: remove entries that no longer exist on the filesystem -s: display all recorded directories with their weights -v: show version information

The alias j is provided for autojump. Example usages:

# j autojump
/root/autojump-master
# jc bin
/root/autojump-master/bin
# jo music
# jco images

If multiple directories match the same keyword, the highest‑weight entry is chosen by default. Prefixing the command with o selects the lower‑weight entry:

# j fi
/opt/two/first
# j o fi
/opt/one/first

Database inspection

List recorded entries and their weights: # j -s The data file is stored at ~/.local/share/autojump/autojump.txt. Do not delete or overwrite this file, as it contains the accumulated statistics.

# ls -l ~/.local/share/autojump/
-rw------- 1 root root 305 Mar 16 16:14 autojump.txt
-rw------- 1 root root  27 Mar 16 11:16 autojump.txt.bak

Limitations and recommendations

Only directories that have been visited with cd are recorded; unvisited paths cannot be jumped to.

Paths beginning with a hyphen ( -) are not supported.

autojump hooks into the $PROMPT_COMMAND variable. Avoid overwriting this variable; if additional commands are needed, append them to the existing $PROMPT_COMMAND value.

Reference

GitHub repository: https://github.com/wting/autojump

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Linuxcommand-lineautojumpdirectory navigation
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.