I stumbled across this zsh tricks post yesterday and am blown away by the
hash command, which allows you to see and manipulate the hash table for either commands or for directory shortcuts.
hash by itself in zsh will output the location for all the commands.
hash -d shows you all of the named directories, and check this out you can navigate to one of those directories with
~shortcutname, like this:
$ hash -d | grep bin bin=/bin daemon=/usr/sbin proxy=/bin sync=/bin $ cd ~daemon $ pwd /usr/sbin
You can create your own directory shortcuts like this:
$ hash -d mydir=/home/me/very/long/path
cd to it:
$ cd ~mydir $ pwd /home/me/very/long/path
Crazy! Read more in the zsh docs.Tweet