A cd command that learns

It is very difficult to teach navigation theory to someone who clings to the shore

Carol Bly 

I found out about autojump on Twitch stream from Chris Titus. He mentioned it briefly, when traversing really quickly through directories in his terminal. I was fascinated from the ease of use, especially when needed to jump to complex “long” name folders.

Enabling autojump in Linux Mint

As author states, autojump is a faster way to navigate your file system. The logic is simple – as you navigate your filesystem, it remembers the directory visit and construct a database for you to use.

It is supported in major Linux distributions, including Linux Mint. Open terminal, write sudo apt install autojump and press enter (don’t forget to call sudo apt update before). You have manual way to add it to your system as well (check here).

 sudo apt install autojump 
Autojump installation

Before you use autojump, you need to add an instruction to be executed on startup. you have that instructions in readme file ( /usr/share/doc/autojump/README.Debian ).

Readme file instructions

Open nano ~/.bashrc to add the command to the shell startup (don’t forget the . (dot), if you are using login shell).

Relaunch terminal in order to enable autojump. If you see permission error, you need to add permission to the shell to execute.

Permission denied

You need to add permission for this script to execute.

chmod +x   /usr/share /autojump/autojump.sh

Maybe you will need to sudo it.

Sudo add permission

Relaunch terminal and you are good to go.

If that doesn’t work, check permission set with ls -ltr /usr/share/autojump/autojump.sh.

ls -ltr /usr/share/autojump/autojump.sh
permission set

If the user is root, then you need to run chown -r [your user] /usr/share/autojump/

chown -r [your user] /usr/share/autojump/

If you don’t have permission for that command, use sudo and confirm changes. Restart terminal and you are good to go.

Using autojump for quicker navigation

Autojump uses j keyboard character for jumping around directories in the terminal. Keep in mind, that you need to visit the directory in order to be added to the database.

Let us create few directories to be able to test out autojump.

mkdir Folder1 Folder2 Folder2/hobby Folder2/hobby2 Folder2/hobby/Company.Project Folder2/hobby/Web.Project

Let us use tree command in order to see the structure. If you don’t have it installed, use sudo apt install tree

install tree and create folder structure

Use tree to see the structure.

tree command and output

Let’s visit out tree structure with cd command and then execute autojump to traverse the structure.

Jumping around

If you have folders with the same name (in my case Project), but different locations, it will weight it (in internal database) and jump to that one. To define more narrow result (which one to jump to), you can use multiple arguments (separated with space.

using multiple arguments


Autojump is useful little util to help you navigate your file system faster and with fewer keystrokes. When I am working on a project, doing some coding, referring to samples, checking documentation, it is really convenient way to quickly jump around without remembering the full names. Few “name” tips, multiple arguments and you are in that folder. Neat!

In the beginning didn’t like the requirement to visit the folder to be added to the database, but that is one time thing (unless you clear everything). Maybe they will add option in the future to define folder and will automatically populate the database.

I will for sure add Autojump to my toolbox going forward with Linux 🙂