The author shares many useful tips for navigating shell environments. Most of them were built-in. The following were particularly relevant to my interests.
cd -
This command takes you to the previously visited directory.
Cut out large sections of long paths with globs. E.g.
~/Downloads/**/mynestedproject
.
setopt nocaseglob # ignore case
setopt correct # correct spelling mistakes
pushd
and popd
pushd
is like cd
but it adds the current
directory to the directory stack prior to the change. You can use
popd
to navigate back to the latest entry on the stack.
hash -d yourprefixname=fullpath
This lets you define custom prefixes such as ~projects
for relative paths. The author cited another source1 for
more info.
CDPATH
The CDPATH
envirionment variable can be set to add
autocompletion and relative path navigation. For example:
CDPATH+=$HOME/Downloads
Now I could cd
into any subdirectory in
Downloads
from any directory.