Hacker News new | ask | show | jobs
by mtrn 5594 days ago
Don't waste your time bookmarking directories, jump right to them ;) https://github.com/rupa/z

`z` tracks your most used directories. After a short learning phase, it will take you to the directory, based on its usage frequency and a hint you give it on the command line. Say I am often cd'ing into /var/www - then after a while I can just type `z ww`.

5 comments

I love projects like this. They so elegantly show what using the right tool for the job can do for you, in terms of code simplicity and conciseness. Doing this in, say, Perl or Python or Ruby, would be entirely possible, and folks who code exclusively in those languages might assume it would be easier in a "more powerful" language...but Bash has so many nice little built-ins that make it really concise and portable. One file, no modules, and it does exactly what it's supposed to do.

I think it's illustrative that the developer went through a Python-based version on the path to building z.

I want to be able to preview the path or directory name that z will navigate to. Something like the way the webkit developer console autocompletes an object, method, or property in light gray color. Or it could be displayed in the terminal title bar. Is that possible?
z is great. I don't know how I lived without it.

It's become so ingrained in my fingers that whenever I switch to a new shell it's the first thing I port over:

https://github.com/sjl/z-zsh

https://github.com/sjl/z-fish

I remember seeing this, but forgot entirely to use it. Have been spending a while looking for it again, or something equivalent. Thanks.
I forgot the url, too. But then I remembered the tagline "z is the new j" - which is enough for google to bring up the repo - even without quotes.
I've created an AUR package for this script, found here: http://aur.archlinux.org/packages.php?ID=46675
Out of the box only with `z -l foo` # list all dirs matching foo (by frequency)