Autojump: an advanced cd command that allows quick navigation in the Linux File System
For Linux users who mainly work through the console or terminal using Linux Command lines, they really feel the power of Linux. However, navigation in Linux's hierarchical file system is sometimes a headache, especially for beginners.
Now, there is a name written in Python namedautojump
Linux Command Line utility, which is an advanced version of the Linux 'cd' command.
Autojump-the fastest way to navigate the Linux File System
This application was originally compiled by Jo ë l Schaerer and is now maintained by + William Ting.
The Autojump application can learn from the user and help the user to perform easier directory navigation in the Linux Command Line. With traditionalcd
Compared with the command, autojump can quickly navigate to the target directory.
Autojump features
- Free and Open Source applications are released under the GPL V3 protocol.
- Applications of Autonomous Learning learn from users' navigation habits.
- Quick navigation. You do not need to include the name of the subdirectory.
- Most standard Linux releases can be downloaded from the software repository, including Debian (testing/unstable), Ubuntu, Mint, Arch, Gentoo, Slackware, CentOS, redHat and Fedora.
- It can also be used on other platforms, such as OS X (using Homebrew) and Windows (implemented through Clink)
- With autojump, you can jump to any specific directory or a sub-directory. You can also use the File Manager to open a directory and view the statistics of the time you spent in a directory.
Prerequisites
- Python version no less than 2.6
Step 2: complete system upgrade
1. perform a system update or upgrade as the root user to ensure that you have installed the latest Python version.
# Apt-get update & apt-get upgrade & apt-get dist-upgrade [APT-based system]
# Yum update & yum upgrade [YUM-based system]
# Dnf update & dnf upgrade [DNF-based system]
Note: In YUM or DNF-based systems, updates and upgrades perform the same actions, which are common for most of the time. This is different from APT-based systems.
Step 2: download and install Autojump
2. As mentioned earlier, autojump is available in most software repositories of Linux releases. You can install it through the Package Manager. But if you want to install it from the source code, you need to clone the source code and execute the python script, as shown below:
Install from source code
If git is not installed, install it. We need to use it to clone the git repository.
# Apt-get install git [APT-based system]
# Yum install git [YUM-based system]
# Dnf install git [DNF-based system]
Once git is installed, Log On As a normal user and clone autojump as follows:
$ git clone git://github.com/joelthelion/autojump.git
Next, usecd
Command to switch to the download directory.
$ cd autojump
Download, grant the executable permission to the installation script file, and run the installation script as a root user.
# chmod 755 install.py
# ./install.py
Install from software warehouse
3. If you don't want to worry about it, you can install it directly from the software repository as a root user:
Install autojump On Debian, Ubuntu, Mint, and similar systems:
# apt-get install autojump
To install autojump in Fedora, CentOS, RedHat, and similar systems, you need to enable the EPEL software repository.
# yum install epel-release
# yum install autojump
Or
# dnf install autojump
Step 2: Configure after installation
4. Debian and its derivative systems (Ubuntu, Mint ,...) To activate the autojump application.
To temporarily activate the autojump application, that is, to make autojump valid until you close the current session or open a new session, run the following command as a regular user:
$ source /usr/share/autojump/autojump.sh on startup
To make autojump permanently valid in BASH shell, you need to run the following command.
$ echo '. /usr/share/autojump/autojump.sh'>>~/.bashrc
Step 2: Pre-test and use of Autojump
5. As previously mentioned, autojump will only jump to the previouscd
Command to the directory. So before we start the test, we need to usecd
Switch to some directories and create some directories. The following is the command I executed.
$ 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 switched to the directories listed above and created some directories for testing. Everything is ready. Let's get started.
Note:j
It is an encapsulation of autojump. You can usej
Instead of autojump.
6. Use the-v option to view the installed autojump version.
$ j -v
Or
$ autojump -v
View the Autojump version
7. Jump to the previous directory '/var/www '.
$ j www
Jump to directory
8. Skip to the subdirectory '/home/avi/autojump-test/B' that you have previously accessed without entering the full name of the subdirectory.
$ jc b
Jump to subdirectory
9. Use the following command to open a file manager from the command line, such as GNOME Nautilus, instead of jumping to a directory.
$ jo www
Open Directory
Open the directory in the File Manager
You can also open a sub-directory in a file manager.
$ jco c
Open subdirectory
Open subdirectory in File Manager
10. view the weights of each folder and the statistics of the total weights calculated from all folders. The folder weight indicates the total time spent in this folder. The folder weight is the number of directories in the list. (LCTT note: In this sentence, I think the if in the original text should be is)
$ j --stat
View folder statistics
Note: The folder where autojump stores its running logs and error logs~/.local/share/autojump/
. Do not rewrite these files. Otherwise, you will lose all your statistical results.
$ ls -l ~/.local/share/autojump/
Autojump logs
11. If necessary, you only need to run the following command to view help:
$ j --help
Autojump help and options
Functional requirements conflict with known ones
- Autojump only allows you to jump to the ones you already use
cd
Directory. Once you usecd
Switch to a specific directory, and this behavior will be recorded in the autojump database so that autojump can work. However, after you set autojump, you cannot skip to those that are useless.cd
Directory.
- You cannot jump to a directory whose name starts with a hyphen. Maybe you can consider reading my articles about operating files or directories, especially those that begin with '-' or other special characters.
- In BASH shell, autojump modifies
$PROMPT_COMMAND
Environment variables to track directory behavior, so we strongly recommend that you do not override$PROMPT_COMMAND
This environment variable. If you need to add other commands to the existing$PROMPT_COMMAND
Environment variable, please add$PROMPT_COMMAND
The end of the environment variable.
Conclusion:
If you are a command line user, autojump is your essential utility. It simplifies many things. It is an excellent program to navigate the Linux directory in the command line. Please try it on your own and let me know your valuable feedback in the comment box below. Keep in touch and share. Love and share it to help us spread it better.
Via: Autojump-An Advanced 'cd' Command to Quickly Navigate Linux Filesystem
Author: Avishek Kumar Translator: FSSlc Proofreader: wxy
This article was originally translated by LCTT and launched with the Linux honor in China
This article permanently updates the link address: