Autojump – An Advanced ‘cd’ Command to Quickly Navigate Linux Filesystem

Step 4: Autojump Pretesting and Usage

5. As said earlier, autojump will jump to only those directories which has 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 cd to the above directory and created a few directories for testing, we are ready to go.

Point to Remember : The usage of j is a wrapper around autojump. You may use j in place of autojump command and vice versa.

6. Check the version of installed autojump using -v option.

$ j -v
or
$ autojump -v
Check Autojump Version

Check Autojump Version

7. Jump to a previously visited directory ‘/var/www‘.

$ j www
Jump To Directory

Jump To Directory

8. Jump to previously visited child directory ‘/home/avi/autojump-test/b‘ without typing sub-directory name.

$ jc b
Jump to Child Directory

Jump to Child Directory

9. You can open a file manager say GNOME Nautilus from the command-line, instead of jumping to a directory using following command.

$ jo www
Jump to Directory

Jump to Directory

Open Directory in File Browser

Open Directory in File Browser

You can also open a child directory in a file manager.

$ jco c
Open Child Directory

Open Child Directory

Open Child Directory in File Browser

Open Child Directory in File Browser

10. Check stats of each folder key weight and overall key weight along with total directory weight. Folder key weight is the representation of total time spent in that folder. Directory weight if the number of directory in list.

$ j --stat
Check Directory Statistics

Check Directory Statistics

Tips : The file where autojump stores run log and error log files in the folder ~/.local/share/autojump/. Don’t overwrite these files, else you may loose all your stats.

$ ls -l ~/.local/share/autojump/
Autojump Logs

Autojump Logs

11. You may seek help, if required simply as:

$ j --help
Autojump Help and Options

Autojump Help and Options

Functionality Requirements and Known Conflicts

  1. 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 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.
  2. You can not jump to a directory, the name of which begins with a dash (-). You may consider to read my post on Manipulation of files and directories that start with ‘-‘ or other special characters”
  3. 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 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 lots of things. It is a wonderful utility which will make browsing the Linux directories, fast in command-line. Try it yourself and let me know your valuable feedback in the comments below. Keep Connected, Keep Sharing. Like and share us and help us get spread.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

16 Responses

  1. anonymous says:

    `$ apt-get install autojumo`

    `$ apt-get install autojump`

    And it’s totally unnecessary to do `apt-get dist-upgrade`

  2. LycaonKoW says:

    Very awesome, more Linux articles need to learn from you guys. Very well put together instructions and I love it, thank you for your work and knowledge base sharing.

  3. Vince says:

    Love its script but i can’t get it to work with j, it seem to only accept autojump as a command. running on mint 17.3

    • Ravi Saive says:

      @Vince,

      Thanks for finding this tool useful, have you seen any output with j? both j and autojump command gives same output? could you share?

    • satoru says:

      I’ve recently rewritten this tool with Go: github.com/suzaku/shonenjump/

      You only need to download a binary for your platform, so it’s easier to install than the original one written in Python.
      What’s more, it’s much faster.

      • Ravi Saive says:

        @Satoru,

        This is Ravi Saive, the founder of Tecmint.com.

        Thanks for sharing your tool with us, why not you write a review post on the same with installation and review about the tool and send us for review for publication in TecMint.com?

  4. Eduardo says:

    I use Fedora 22 and I installed autojump from Fedora repository, but j command is not recognized and the command for bash activation gets “file or command not found”.

  5. Eduardo says:

    I am using Fedora 22 and autojump is in Fedora repository. Version is 21.7.1-4. I have installed autojump but I get error messages “j: command not found” and I tried activate autojump temporarily, but the error message was: “bash: /usr/share/autojump/autojump.sh: file or directory not found”. Indeed, I tried activate autojump permanently, but I got error message too.

    • Victor1 says:

      I had to use rpm -ql autojump to see where autojump.sh is located because it seems like the path that is given in the post for the location of autojump.sh is wrong. Or search for autojump.sh and add those commands at the end of the post.

  6. cool.
    Btw. notable fact: bash has a simplistic directory bookmarking feature.
    By defining first two lines in .bashrc allows directory jumping:

    ~$ shopt -s cdable_vars
    ~$ export foo=/usr/share/lib/foo/bar
    ~$ cd foo
    /usr/share/lib/foo/bar $

    here’s a screencast about it:

    http://playterm.org/r/directory-bookmarks-using-shopt-1425641930

    nevertheless autojump is a cool productivity tool.

  7. omipenguin says:

    It gives this error when i try to install it

    ./install.py
    File “./install.py”, line 40
    with open(os.path.join(etc_dir, ‘autojump.sh’), ‘a’) as f:
    ^
    SyntaxError: invalid syntax

    • Avishek Kumar says:

      @ omipenguin,
      Let me know your Python Version and OS details. You may email me your SSH access at avishek1210[at]gmail.com, for better assistance.

  8. balu says:

    I have installed it through yum in centos 6.3,
    When i type the command “autojump -v”, it gives me following error “Unknown command line argument: option -v not recognized”
    When i do # j or #autojump , it executes but not going to the dir.

    • Avishek Kumar says:

      @balu

      I have already mentioned that autojump learns from you. After installing it, you need to train it. cd to your most-frequently visited directories and then it will work.

      However, if you could not do it, you may write me an email @ avishek1210[at]gmail.com with your Input commands. your Output Message and your SSH access very clearly, so that i can assist.

  9. Chang Limin says:

    It’s a good command. I think it will be better if integrate some functions from pushd/popd.

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.