Z - Jump to directories that you actually use.
github.com
github.com
Thanks a million! :D
% pwd
/home/aram
% cd mstate
/home/aram/src/launchpad.net/juju-core/mstate
% cd go/src
/home/aram/go/src
% cd plan9
/home/aram/plan9
%
It uses the $CDPATH environment variable ($cdpath in rc(1)). $CDPATH is a list of places in which to search for the wanted directory. I put all the things I regularly use there, and my cds are almost always short, usually just a single name.I don't maintain $CDPATH myself, my profile runs a one liner that descends into certain directories and constructs $CDPATH for me within the constrains of some rules (for example excludes leafs, excludes {bin,doc,pkg,test}, etc).
Finding about $CDPATH was a huge productivity boost to me, not only in time saved typing, but in allowing me to change the way I work. I now rarely care where things in the filesystem are (e.g. various source code for various software, where the build products are, etc). I used to do a lot of moving and symlinking around, to arrange stuff so I remember where I've put it and to keep paths short, but now I don't care. It could be wherever, it's just one name away. The namespace had become a big hash.
[1] http://doc.cat-v.org/plan_9/4th_edition/papers/rc
[2] http://en.wikipedia.org/wiki/Tom_Duff
export CDPATH=.:~
cdpaths="$([ -d ~/src ] && find ~/src -mindepth 1 -type d | egrep -v '/(\.)|_[a-zA-Z0-9]' | egrep -v '(bin)|(cmd)|(doc)|(lib)|(pkg)|(test)' | xargs -n1 dirname | uniq)"
for i in $cdpaths; do
CDPATH=$CDPATH:$i
done- $CDPATH requires manual management. You're using a line in profile, but I imagine that's limited to specific directories and creates overhead when creating new shells. - What happens with namespace collision? First entry in $CDPATH wins? - Fuzzy searching for mistyped directory names. I don't find this feature that useful personally, but was requested quite a bit by others.
William (autojump maintainer)
Tools like Z and autojump are fantastic timesavers.
'The search path for the cd command. This is a colon-separated list of directories in which the shell looks for destination directories specified by the cd command. A sample value is ".:~:/usr".'
Frecency is a portmantaeu of ’recent’ and ’frequency’. It is a weighted rank that depends on how often and how recently something occured. As far as I know, Mozilla came up with the term.
alias zls='z \!*;ls;cd -'
(with additional zll etc for ls -l or -a)I also set .bash_profile aliases to quickly cd up the directory tree with just dots. It's silly, but surprising helpful.
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..' alias cd..='cd ..'
:)PS: The whole story on my blog https://chanux.wordpress.com/2012/08/09/no-more-cd-dot-dot-s...