alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias ......='cd ../../../../..'
alias .......='cd ../../../../../..'
Merry christmas, HN! alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias ......='cd ../../../../..'
alias .......='cd ../../../../../..'
Merry christmas, HN!shopt -s autocd
which makes it so naming a directory cd's to it, including .. ~ etc.
So you can just type something like `up 2` to move by two directories.
You can do just `cdb 5` to navigate 5 directories back.
shopt -s cdable_vars
u2=../.. u3=../../.. u4=../../../.. u5=../../../../.. function ..() {
local temp_dir=$PWD
cd ..
for token in "$@"; do
cd ..
done
OLDPWD=$temp_dir
}
so you can just type .. to go up once or .. [word] to go up twice and so onObviously, it might not be an issue for your use, but just noting a potential gotcha if I were to lift it for example.
[ Golf-y zsh, because vacation time and AoC has finished: ..() { cd ../${(pj:/:)${@/*/..}} } ]
¹ even just expensive setup/teardown delays would feel odd*