cn23vg
Last Updated: February 25, 2016
·
1.724K
· lxe
Me

Save time typing paths with Autojump: arguably the most important shell tool.

Autojump is a way to navigate directory paths using fuzzy and intelligent search.

I started using about 4 years ago, and it have probably saved an entire month of my time typing cd paths. It's my #1 recommended shell tool. Here's a scenario:

Without autojump:

# Let's start working on a project
cd ~/devel/work/backends/project1
vim .

# Hmm.. we need to edit some module feature
cd node_modules/fancy_module/lib/feature
vim file.js

# Aah... gotta edit my nginx config
cd /etc/nginx/sites_available/
vim my-site.conf

# Back to the project....
cd ~/devel/work/backends/project1

With autojump:

# Let's start working on a project
j pro
vim .

# Hmm.. we need to edit some module feature
j fan lib
vim file.js

# Aah... gotta edit my nginx config
j si a
vim my-site.conf

# Back to the project....
j pro

As you can see, I don't even have to remember the full name of the path with autojump (the j command). I just need to remember some parts of the name, and autojump auto-jumps you to a location based on how much time you've spent there, and how long ago you've accessed it (or probably using some kind of mind-reading magic).

This tool is an absolute must-have for anyone who spends their days in a terminal.

To install on OSX:

brew install autojump && echo \
  '[[ -s `brew --prefix`/etc/autojump.sh ]] && . `brew --prefix`/etc/autojump.sh' >> \
  $(ls ~/.bash_profile 2>/dev/null || ls ~/.zshrc)

An example to get started:

mkdir test-dir another-dir
cd test-dir
cd ../another-dir
j test
j another
Say Thanks
Respond

10 Responses
Add your response

14403
78ac7450752d7b4882df4c6e53e230db

'll take a look into this. Thanks for the tip!

over 1 year ago ·
14404

Another alternative is the 'z' command :)

over 1 year ago ·
14409
2353857b3f577eb4e3840111ca9a7ecb
over 1 year ago ·
14410
9927dee057194c0727faed318c91514e

Been using z.sh for this, too. Huge timesavers!

over 1 year ago ·
14411
D42a7264714dee5006b9c99d2567a320

I rolled a simpler, more specific solution that I still use:

# quickly jump to a project
prj() { cd "$HOME/projects/${*}"; }
over 1 year ago ·
14412
D42a7264714dee5006b9c99d2567a320

@astropanic fasd looks too hardcore to me :)

over 1 year ago ·
14421
2353857b3f577eb4e3840111ca9a7ecb

@dpashkevich it allows you to lazy switch directories and opening files too, look at the examples :)

over 1 year ago ·
14422
D42a7264714dee5006b9c99d2567a320

@astropanic I know, but I think something like v def conf is way too cryptic

over 1 year ago ·
14483
7a1054e17f3c41c66b1b28d4d6b09379

I have used z for quite some time. https://github.com/rupa/z

over 1 year ago ·
14505
Aee7eabef46c69a79d95081ee6946389

thx, using from now on

over 1 year ago ·
Filed Under