A different way to do the usual …=“cd …” and endless chains of …=“cd …/…” types of aliases:
bash/ksh version:
<span style="color:#323232;">..() {
</span><span style="color:#323232;"> local count="${1:-1}"
</span><span style="color:#323232;"> local path="../"
</span><span style="color:#323232;"> while (( --count > 0 )); do
</span><span style="color:#323232;"> path="$path../"
</span><span style="color:#323232;"> done
</span><span style="color:#323232;"> cd -- "$path"
</span><span style="color:#323232;">}
</span>
zsh single-line version:
<span style="color:#323232;">..() { cd $(printf "../%.s" {1..${1:-1}}) }
</span>
These take the number of directories that you want to move up as an argument (e.g. … 3), otherwise they move you up one directory when used with no arguments.