Once in a while you discover a tool that makes you wonder how you ever lived without it. Autojump is such a tool. It allows blazing fast file system navigation from the terminal by letting you to jump to any path you previously visited. The command
j born2code changes directory to
/Users/pjvds/dev/born2code.net. Autojump doesn’t need the full directory name, a small piece is enough. It will match your input with a list of weighted paths and picks the one on top.
How does autojump work
Autojump stores the paths you visit in a simple textfile called
autojump.txt. Picture the following
That command will update your autojump.txt file to look like this:
cd to another directory with the following.
Autojump.txt file will contain both directories.
10 /Users/pjvds/dev/getting-started-ruby/src 10 /Users/pjvds/dev/getting-started-python/src
10 in front of both lines is the weight of the directories. They now have both the same weight because they are both visited once. Now when one of the directories is visited again the weight will get updated.
Will update the weight of
14 /Users/pjvds/dev/getting-started-python/src 10 /Users/pjvds/dev/getting-started-ruby/src
/Users/pjvds/dev/getting-started-python/src is now the heaviest weighted path in the list. If you want to change directory to it – in other words jumping – you simply execute the following.
pwd command would output
j jump command will also update the weight of a directory. So the
autojump.txt now looks like the following:
17 /Users/pjvds/dev/getting-started-python/src 10 /Users/pjvds/dev/getting-started-ruby/src
You can give extra hints to autojump. If I want to jump to the ruby
src instead of the heavier weighted python one I simply do the following:
j ruby src
Installation information and more examples can be found at the Github page. Happy jumping!