I've been using the following in some form for over 3 decades!
(now in zsh)<p><pre><code> alias .=cd
</code></pre>
In /bin/sh "." sources a script. While this can be common in a script, one rarely does this interactively so I usurped . for the most common operation!<p><pre><code> alias ,=pushd
alias ,,=popd
alias ,.=dirs
</code></pre>
Think of cd as a goto, pushd as a call, popd as a return and dirs as a stack trace!<p><pre><code> ..() { cd ../$* }
cdpath=(. .. ~/src ~)
</code></pre>
Use of cdpath can be confusing so it is best to show part of $PWD in the prompt:<p><pre><code> PS1="%* %5. %h%(#.#.:) "
</code></pre>
This ends the prompt with a # if you are running as superuser.<p>These aliases/functions are enabled in .zshrc (<i>only</i> if run interactively -- that is, they are included below the following test):<p><pre><code> if [[ ! -o interactive ]] ; then return; fi
</code></pre>
The "benefit" of Jeroen's mark/unmark is that these paths persist (and can be used from any window running a shell. I have not found much need for that + I can have different $dirs in different windows. Also, given that my shell windows (under screen) persist for a very long time, I don't need symlink's persistence!<p>Alternatively I define "." to be a function that does arg specific operation (cd if a dir, acroread if .pdf, vi if text etc.).