Ask HN: Best Unix Tricks? 17 years ago
Can't remember where I found this, but this function allows you to go up any level of dirs without specifying an infinite number of aliases.
Usage: up {x} where x is the number of directories you want to go up (e.g., 3)
function up() { local arg=${1:-1} local dir="" while [ $arg -gt 0 ]; do dir="../$dir" arg=$(($arg - 1)); done cd $dir >&/dev/null }