Terminal Directory Jumping

For a long time I have used go-tool to help jump to directries in the terminal. Recently, I discovered z, which does the same thing but better.

go-tool

You can find go-tool on google code. Using it is a two step process. First you create an alias:

... go -a dir-alias

This it stores the current directory under the alias "diralias". Now, when you want to jump to that directory, you:

... go dir-alias

The only "issue" I had with using go-tool is remembering to make alias' and then remembering what I named a long forgotten directory's alias. This is where z shines.

Z

Unlike go-tool, z does not require you to actively alias a directory in order create a jump hook. All you need to do is cd into the directory and z registers the path for you. Now when you want to jump to the directory all you need to do is input a part of the path:

... z dirname

Directory names are often the same, so you can also type in portions of the path that helps z discover the correct path:

... z part of the path dirname

For a live example, here's a path I find myself jumping to often:

/Users/mark/Documents/dev/active/wwat-admin

Simply entering z ww ad will jump me to the directory, as will z ww due to the fact that it is the most used directory. There are a number of directories whose name is prefixed with "wwat-" however. If I'd like to see those directories I just have to hit TAB instead of RETURN and z will autocomplete the path and list all similar diretories:

... z ww
... z /Users/mark/Documents/dev/active/wwat-admin
/Users/mark/Documents/dev/active/wwat-admin/.git
/Users/mark/Documents/dev/active/wwat-admin/src
/Users/mark/Documents/dev/active/wwat-clients
/Users/mark/Documents/dev/active/wwat-site

Focus remains on the command line until you hit return, so you can edit the expanded path to match one of the alternative directories.

Tags: toolsterminal

comments powered by Disqus