Faster Terminal Navigation with Autojump

In Praise of The CLI

One reason the GUI exists is to speed up and make clearer basic user interaction with a computer. Take, for example, moving around the Finder on OSX. If you want to open a file, you have to use a series of visual representation using the mouse as your only means of navigation.

Cool, right? In many ways, the GUI is incredible; it is in part what has enabled computers to become so useful in the world. Without a GUI for people to interact with, widespread use of computers would likely be diminished.

However, as powerful as this is, it's not the only way to go about doing things. Using the terminal, we can interact with a computer using text commands like cd, ls, mkdir, l, and so on. For the majority of navigation/interaction tasks, the CLI model allows for much more power and speed than a typical GUI can provide1. It's fantastic for saving time and increasing what you can do. However, cding and lsing through a dense file tree can get old.

Autojump

greping can save us a ton of time, but there are other solutions that people have come up with to make terminal navigation easier. My favorite is Autojump. It's a great project that 'learns' as you navigate, making it a really powerful tool.

Requirements

  • Python v2.6+
  • Supported shells:
    • bash v4.0+
    • zsh
    • fish
    • tcsh (experimental)
    • clink on Windows (experimental)

Installation

Easy installation (Mac OS X):

brew install autojump

or, if you're using Mac Ports

port install autojump

Usage

Autojump uses j in place of cd to move around. As previously noted, it 'learns' as you go, creating a weighted keybase.

  • Jump to a directory that contains foo:

    j foo
    
  • Jump to a child directory

    jc bar
    
  • Jump to a child directory

    jc bar
    
  • Open file manager with directory

    jo bar
    
  • Open file manager with directory

    jco foo
    
  • Multiple arguments

Where j in might be higher weighted and send you to path/to/work/inbox, specifying multiple arguments gives you the option to choose a different superset to pick from:

j home in

Will send you to: path/to/home/inbox

  • View all autojump commands

    autojump --help
    

1 However, this is not true for everything—can you imagine trying to manipulate a photoshop document via the CLI? Actually, come to think of it, it seems like CSS is just that :-S...