Autojump: an advanced cd command that allows quick navigation in the Linux File System

Source: Internet
Author: User

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 namedautojumpLinux 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 traditionalcdCompared 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.

  1. # Apt-get update & apt-get upgrade & apt-get dist-upgrade [APT-based system]
  2. # Yum update & yum upgrade [YUM-based system]
  3. # 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.

  1. # Apt-get install git [APT-based system]
  2. # Yum install git [YUM-based system]
  3. # Dnf install git [DNF-based system]

Once git is installed, Log On As a normal user and clone autojump as follows:

  1. $ git clone git://github.com/joelthelion/autojump.git

Next, usecdCommand to switch to the download directory.

  1. $ cd autojump

Download, grant the executable permission to the installation script file, and run the installation script as a root user.

  1. # chmod 755 install.py
  2. # ./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:

  1. # apt-get install autojump

To install autojump in Fedora, CentOS, RedHat, and similar systems, you need to enable the EPEL software repository.

  1. # yum install epel-release
  2. # yum install autojump
  3. Or
  4. # 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:

  1. $ source /usr/share/autojump/autojump.sh on startup

To make autojump permanently valid in BASH shell, you need to run the following command.

  1. $ 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 previouscdCommand to the directory. So before we start the test, we need to usecdSwitch to some directories and create some directories. The following is the command I executed.

  1. $ cd
  2. $ cd
  3. $ cd Desktop/
  4. $ cd
  5. $ cd Documents/
  6. $ cd
  7. $ cd Downloads/
  8. $ cd
  9. $ cd Music/
  10. $ cd
  11. $ cd Pictures/
  12. $ cd
  13. $ cd Public/
  14. $ cd
  15. $ cd Templates
  16. $ cd
  17. $ cd /var/www/
  18. $ cd
  19. $ mkdir autojump-test/
  20. $ cd
  21. $ mkdir autojump-test/a/&& cd autojump-test/a/
  22. $ cd
  23. $ mkdir autojump-test/b/&& cd autojump-test/b/
  24. $ cd
  25. $ mkdir autojump-test/c/&& cd autojump-test/c/
  26. $ cd

Now, we have switched to the directories listed above and created some directories for testing. Everything is ready. Let's get started.

Note:jIt is an encapsulation of autojump. You can usejInstead of autojump.

6. Use the-v option to view the installed autojump version.

  1. $ j -v
  2. Or
  3. $ autojump -v

View the Autojump version

7. Jump to the previous directory '/var/www '.

  1. $ 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.

  1. $ 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.

  1. $ jo www

Open Directory

Open the directory in the File Manager

You can also open a sub-directory in a file manager.

  1. $ 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)

  1. $ 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.

  1. $ ls -l ~/.local/share/autojump/

Autojump logs

11. If necessary, you only need to run the following command to view help:

  1. $ j --help

Autojump help and options

 

Functional requirements conflict with known ones
  • Autojump only allows you to jump to the ones you already usecdDirectory. Once you usecdSwitch 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.cdDirectory.
  • 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_COMMANDEnvironment variables to track directory behavior, so we strongly recommend that you do not override$PROMPT_COMMANDThis environment variable. If you need to add other commands to the existing$PROMPT_COMMANDEnvironment variable, please add$PROMPT_COMMANDThe 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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.