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.
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.shInstallation
Download the source archive from the official GitHub repository and unzip it.
unzip autojump-master.zip
cd autojump-master
./install.py # or ./uninstall.pyThe 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 ~/.bashrcVerify the installation:
autojump --version # or j -vCommand 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 imagesIf 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/firstDatabase 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.bakLimitations 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
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
