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
7. Jump to a previously visited directory ‘/var/www‘.
$ j www
8. Jump to previously visited child directory ‘/home/avi/autojump-test/b‘ without typing sub-directory name.
$ jc b
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
You can also open a child directory in a file manager.
$ jco c
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
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/
11. You may seek help, if required simply as:
$ j --help
Functionality Requirements and Known Conflicts
- 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.
- 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”
- 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.
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.