Those Linux users who mainly work with Linux command Line via console/terminal feels the real power of Linux. However, it may sometimes be painful to navigate inside the Linux Hierarchical file system, especially for newbies.
There is a Linux command-line utility called autojump, which was written in Python by Jo?l Schaerer and now maintained by William Ting, which is an advanced version of the cd command.
Autojump is a command-line tool that offers a faster way to navigate the Linux file system by keeping the database of directories that the user visits frequently. It works by keeping an eye on the directories that the user navigates and then assigning importance to each directory based on how regularly the user visits.
This allows users to quickly jump to a frequently visited directory. Autojump navigates to the required directory more quickly as compared to the traditional cd command.
Features of autojump
- Free and open source application and distributed under GPL V3
- A self-learning utility that learns from the user’s navigation habit.
- Faster navigation. No need to include the subdirectories’ names.
- Available in the repository to be downloaded for most of the standard Linux distributions including Debian, Ubuntu, Mint, Arch, Gentoo, Slackware, CentOS, RedHat, and Fedora.
- Available for other platforms as well, like OS X (Using Homebrew) and Windows (enabled by Clink)
- Using autojump you may jump to any specific directory or to a child directory. Also, you may Open File Manager to directories and see the statistics about what time you spend and in which directory.
Step 1: Do a Full System Update
1. Do a system Update/Upgrade as a root user to ensure you have the latest version of Python installed.
# apt-get update && apt-get upgrade && apt-get dist-upgrade [<strong>APT</strong> based systems] # yum update && yum upgrade [<strong>YUM</strong> based systems] # dnf update && dnf upgrade [<strong>DNF</strong> based systems]
Step 2: Download and Install Autojump
2. As stated above, autojump is already available in the repositories of most Linux distributions. You may just install it using the Package Manager.
yum install epel-release
command.Install Autojump from Repositories
$ sudo apt install autojump [On <strong>Debian, Ubuntu and Mint</strong>] $ sudo yum install autojump [On <strong>RHEL/CentOS/Fedora</strong> and <strong>Rocky/AlmaLinux</strong>] $ sudo emerge -a autojump [On <strong>Gentoo Linux</strong>] $ sudo apk add autojump [On <strong>Alpine Linux</strong>] $ sudo pacman -S autojump [On <strong>Arch Linux</strong>] $ sudo zypper install autojump [On <strong>OpenSUSE</strong>]
However, if you want to install autojump from the source, you need to clone the source code and execute the Python script, as:
Installing Autojum from Source
Install git, if not installed, which is required to clone the autojump git repository.
$ sudo apt install git [On <strong>Debian, Ubuntu and Mint</strong>] $ sudo yum install git [On <strong>RHEL/CentOS/Fedora</strong> and <strong>Rocky/AlmaLinux</strong>] $ sudo emerge -a git [On <strong>Gentoo Linux</strong>] $ sudo apk add git [On <strong>Alpine Linux</strong>] $ sudo pacman -S git [On <strong>Arch Linux</strong>] $ sudo zypper install git [On <strong>OpenSUSE</strong>]
Once git has been installed, log in as normal user and then clone autojump as:
$ git clone git://github.com/joelthelion/autojump.git
Next, switch to the downloaded directory using the cd command.
$ cd autojump
Now, make the script file executable and run the install script as the root user.
# chmod 755 install.py # ./install.py
Step 3: Autojump Configuration
3. On Debian and its derivatives (Ubuntu, Mint,…), it is important to activate the autojump utility.
To activate the autojump utility temporarily, i.e., effective till you close the current session, or open a new session, you need to run the following commands as a normal user:
$ source /usr/share/autojump/autojump.sh on startup OR $ source /usr/share/autojump/autojump.bash on startup
To permanently add activation to the BASH shell, you need to run the below command.
$ echo '. /usr/share/autojump/autojump.sh' >> ~/.bashrc Or $ echo '. /usr/share/autojump/autojump.bash' >> ~/.bashrc
Step 4: Quickly Change Linux Directory Using Autojump
4. As said earlier, autojump will jump to only those directories which have been cd
earlier. So before we start testing we are going to ‘cd‘ a few directories and create a few as well.
Here is what I did.
$ cd $ cd $ cd Desktop/ $ cd $ cd Documents/ $ cd $ cd Downloads/ $ cd $ cd Music/ $ cd $ cd Pictures/ $ cd $ cd Public/ $ cd $ cd Templates $ cd $ cd /var/www/ $ cd $ mkdir autojump-test/ $ cd $ mkdir autojump-test/a/ && cd autojump-test/a/ $ cd $ mkdir autojump-test/b/ && cd autojump-test/b/ $ cd $ mkdir autojump-test/c/ && cd autojump-test/c/ $ cd
Now we have a cd to the above directory and created a few directories for testing, we are ready to go.
j
is a wrapper around autojump. You may use j in place of the autojump command and vice versa.5. Check the version of installed autojump using -v
option.
$ j -v or $ autojump -v
6. Jump to a previously visited directory ‘/var/www‘.
$ j www
7. Jump to the previously visited parent/child directory ‘/home/avi/autojump-test/b‘ without typing a sub-directory name.
$ jc b
8. You can open a file manager that says GNOME Nautilus from the command-line, instead of jumping to a directory using the following command.
$ jo www
You can also open a child directory in a file manager.
$ jco c
9. Check stats of each folder key weight and overall key weight along with total directory weight. Folder key weight is the representation of the total time spent in that folder. Directory weight is the number of directories in the list.
$ j --stat
~/.local/share/autojump/
. Don’t overwrite these files, or else you may lose all your stats.$ ls -l ~/.local/share/autojump/
10. You may seek help if required simply as:
$ j --help
How Autojump Works
-
- autojump lets you jump to only those directories to which you have already cd. Once you cd to a particular directory, it gets logged into the autojump database and thereafter autojump can work. You can not jump to a directory to which you have not cd, after setting up autojump, no matter what.
- You can not jump to a directory, the name of which begins with a dash
(-)
. You may consider reading my post on the Manipulation of files and directories that start with'-'
or other special characters - In BASH Shell autojump keeps track of directories by modifying $PROMPT_COMMAND. It is strictly recommended not to overwrite $PROMPT_COMMAND. If you have to add other Linux commands to existing $PROMPT_COMMAND, append it to the last to existing $APPEND_PROMPT.
Conclusion
autojump is a must utility if you are a command-line user. It eases a lot of things. It is a wonderful utility that will make navigating the Linux directories, fast in the command line. Try it yourself and let me know your valuable feedback in the comments below. Keep Connected, and Keep Sharing. Like and share us and help us get spread.
The above is the detailed content of Autojump - A Faster Way to Navigate Directories in Linux. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

LXD is described as the next-generation container and virtual machine manager that offers an immersive for Linux systems running inside containers or as virtual machines. It provides images for an inordinate number of Linux distributions with support

Firefox browser is the default browser for most modern Linux distributions such as Ubuntu, Mint, and Fedora. Initially, its performance might be impressive, however, with the passage of time, you might notice that your browser is not as fast and resp

When encountering DNS problems, first check the /etc/resolv.conf file to see if the correct nameserver is configured; secondly, you can manually add public DNS such as 8.8.8.8 for testing; then use nslookup and dig commands to verify whether DNS resolution is normal. If these tools are not installed, you can first install the dnsutils or bind-utils package; then check the systemd-resolved service status and configuration file /etc/systemd/resolved.conf, and set DNS and FallbackDNS as needed and restart the service; finally check the network interface status and firewall rules, confirm that port 53 is not

If you find that the server is running slowly or the memory usage is too high, you should check the cause before operating. First, you need to check the system resource usage, use top, htop, free-h, iostat, ss-antp and other commands to check CPU, memory, disk I/O and network connections; secondly, analyze specific process problems, and track the behavior of high-occupancy processes through tools such as ps, jstack, strace; then check logs and monitoring data, view OOM records, exception requests, slow queries and other clues; finally, targeted processing is carried out based on common reasons such as memory leaks, connection pool exhaustion, cache failure storms, and timing task conflicts, optimize code logic, set up a timeout retry mechanism, add current limit fuses, and regularly pressure measurement and evaluation resources.

As a system administrator, you may find yourself (today or in the future) working in an environment where Windows and Linux coexist. It is no secret that some big companies prefer (or have to) run some of their production services in Windows boxes an

Frankly speaking, I cannot recall the last time I used a PC with a CD/DVD drive. This is thanks to the ever-evolving tech industry which has seen optical disks replaced by USB drives and other smaller and compact storage media that offer more storage

In Linux systems, 1. Use ipa or hostname-I command to view private IP; 2. Use curlifconfig.me or curlipinfo.io/ip to obtain public IP; 3. The desktop version can view private IP through system settings, and the browser can access specific websites to view public IP; 4. Common commands can be set as aliases for quick call. These methods are simple and practical, suitable for IP viewing needs in different scenarios.

Built on Chrome’s V8 engine, Node.JS is an open-source, event-driven JavaScript runtime environment crafted for building scalable applications and backend APIs. NodeJS is known for being lightweight and efficient due to its non-blocking I/O model and
