AutoJump: A high-level CD command that can be quickly navigated from the Linux file system

Source: Internet
Author: User
Tags python script git clone

Related blog: https://linux.cn/article-3401-1.html

For Linux users who work primarily through the console or terminal using the Linux command line, they really feel the power of Linux. Navigating a Linux layered file system, however, can sometimes be a headache, especially for beginners.

Now, there is a autojump Linux command-line utility, written in Python, which is the advanced version of the Linux ' CD ' command.

The quickest way to Autojump–linux file system navigation

This application was originally written by Jo?l Schaerer and is now maintained by +william Ting.

The AutoJump app can learn from the user and help users make easier directory navigation on the Linux command line. Compared to traditional cd commands, AutoJump can navigate to the destination directory more quickly.

Features of AutoJump
    • Free and open source applications are released under the GPL V3 agreement.
    • The application of autonomous learning, from the user's navigation habits learning.
    • Navigate more quickly. You do not have to include the names of subdirectories.
    • For most standard Linux distributions, they can be downloaded from the repositories, including Debian (testing/unstable), Ubuntu, Mint, Arch, Gentoo, Slackware, CentOS, RedHat and F Edora.
    • can also be used in other platforms, such as OS X (using Homebrew) and Windows (via Clink)
    • With AutoJump you can jump to any particular directory or to a subdirectory. You can also open a directory with the File Manager and view statistics on the time you spend in a directory.
Premise
    • Python with a version number of no less than 2.6

1th step: Make a complete system upgrade

1, as the root user, do a system update or upgrade, so that you install the latest version of Python.

    1. # apt-get update && apt-get upgrade && apt-get dist-upgrade [基于 APT 的系统]
    2. # yum update && yum upgrade [基于 YUM 的系统]
    3. # dnf update && dnf upgrade [基于 DNF 的系统]

Note : This is a special reminder that in YUM or DNF-based systems, updates and upgrades perform the same actions, most of the time they are generic, unlike APT-based systems.

2nd step: Download and install AutoJump

2. As mentioned earlier, AutoJump can be obtained in most Linux distribution repositories. With the Package Manager you can install it. 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 here:

Installing from source code

If you don't have git installed, install it. We need to use it to clone a git repository.

    1. # apt-get install git [基于 APT 的系统]
    2. # yum install git [基于 YUM 的系统]
    3. # dnf install git [基于 DNF 的系统]

Once you have installed Git, log in as a normal user and clone AutoJump as follows:

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

Next, use the cd command to switch to the download directory.

    1. $ cd autojump

Download, give the installation script file permission to execute, and run the installation script as the root user.

    1. # chmod 755 install.py
    2. # ./install.py

Installing from the Software Warehouse

3, if you do not want trouble, you can install it as root user from the repository directly:

Install AutoJump in Debian, Ubuntu, Mint and similar systems:

    1. # apt-get install autojump

In order to install AutoJump in Fedora, CentOS, RedHat and similar systems, you need to enable EPEL repositories. Http://www.linuxidc.com/Linux/2013-12/93433.htm

    1. # yum install epel-release
    2. # yum install autojump
    3. # dnf install autojump

3rd Step: Post-installation configuration

4. In Debian and its derivative systems (Ubuntu, Mint,...), it is very important to activate the AutoJump application.

In order to temporarily activate the AutoJump app, you need to run the following command as a regular user until you close the current session or open a new session until you have autojump in effect:

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

To make AutoJump permanent in the BASH shell, you need to run the following command.

    1. $ echo ‘. /usr/share/autojump/autojump.sh‘>>~/.bashrc

The 4th step: AutoJump Test and use

5, as previously stated, AutoJump will only jump to cd the directory that was previously ordered. So before we start the test, we're going to use cd a switch to some directory and create some directories. Here 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 that we've switched to the directories listed above and created some directories for testing, everything is ready, let's get started.

one point to keep in mind : j AutoJump is a package that you can use j instead of autojump.

6. Use the-V option to view the version of the installed AutoJump.

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

View the version of AutoJump

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

    1. $ j www

Skip to Directory

8. Skip to the previous subdirectory '/home/avi/autojump-test/b ' without typing the full name of the subdirectory.

    1. $ jc b

Jump to subdirectories

9. Using the command below, you can open a file manager from the command line, such as GNOME Nautilus, instead of jumping to a directory.

    1. $ jo www

Open Directory

Open a directory in File Manager

You can also open a subdirectory in a file manager.

    1. $ jco c

Open sub-Directory

Open subdirectories in File Manager

10. View the weights of each folder and the statistics of the total weights calculated by all folders. The weight of the folder represents the total time spent in this folder. The folder weight is the number of the table of contents in the list. (LCTT: In this sentence, I think the original if should be is)

    1. $ j --stat

View folder Statistics

Reminder : AutoJump stores its run logs and error logs where it is a folder ~/.local/share/autojump/ . Do not rewrite these files, otherwise you will lose all of your statistical status results.

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

AutoJump's Log

11, if necessary, you can only run the following command to view the help:

    1. $ j --help

Help and options for AutoJump

Functional requirements and known conflicts
    • AutoJump only lets you jump to those directories you've already used cd . Once you cd switch to a specific directory, the behavior is recorded in the AutoJump database so that the autojump can work. Anyway, after you set the AutoJump, you can't jump to a directory that you didn't use cd .
    • You cannot jump to a directory whose name begins with a dash (-). Perhaps you might consider reading my article about manipulating files or directories, especially about manipulating files and directories that start with '-' or other special characters.
    • In the BASH shell, AutoJump $PROMPT_COMMAND keeps track of directory behavior by modifying environment variables, so it is highly recommended that you do not rewrite $PROMPT_COMMAND this environment variable. If you need to add additional commands to an existing $PROMPT_COMMAND environment variable, add to the last of the $PROMPT_COMMAND environment variables.

Conclusion:

If you are a command-line user, AutoJump is an essential utility for you. It can simplify many things. It is a great program for navigating the Linux directory on the command line. Please try it yourself and let me know your valuable feedback in the comments box below. Keep in touch and keep sharing. Love and share, help us to spread better.

AutoJump: A high-level CD command that can be quickly navigated from the Linux file system

Related Article

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.