Seeing your up alias reminded me of a bash function I setup a while ago also called up. I use it to simulate doing cd .. n number of times. e.g. up 5 would go up 5 directory levels.
up ()
{
local levels;
local i;
[[ -z "$1" ]] && levels=1 || levels="$1";
for ((i=0; i<levels; i++))
docd ../;
done
}
It’s probably the smallest, yet most convenient thing I’ve setup on my machines. Especially so if you work in languages with lots of nested subdirectories (like Java).
Seeing your
up
alias reminded me of a bash function I setup a while ago also calledup
. I use it to simulate doingcd ..
n number of times. e.g.up 5
would go up 5 directory levels.up () { local levels; local i; [[ -z "$1" ]] && levels=1 || levels="$1"; for ((i=0; i<levels; i++)) do cd ../; done }
It’s probably the smallest, yet most convenient thing I’ve setup on my machines. Especially so if you work in languages with lots of nested subdirectories (like Java).
i setup several aliases
alias ..='cd ..' alias ...='cd ../../.' alias ...='cd ../../../.' alias ....='cd ../../../../.'
and so on…