2 ms·
> alias .....="cd ../../../.." How often do you use that and how often do you get it right? :-) My cd related aliases are the following. Especially the .<numb
by bhaak 8y ago
> alias .....="cd ../../../.."
How often do you use that and how often do you get it right? :-)
My cd related aliases are the following. Especially the .<number> is surprisingly useful, although most of the time I only use .2 and .3
alias ..='cd ../'
alias .1='cd ../'
alias .2='cd ../../'
alias .3='cd ../../../'
alias .4='cd ../../../../'
alias .5='cd ../../../../../'
# sometimes, the space gets swallowed
alias cd.='cd .'
alias cd..='cd ..'
But that gave me an idea for another useful directory changer: "go to project root".
Project root definition could vary, although nowadays it is probably "go to the first directory upstream with a .git directory"
Edit: found this elsewhere in this discussion posted by jgresty https://news.ycombinator.com/item?id=18901834 https://news.ycombinator.com/item?id=18901834
# go to root git directory
alias cdgit='cd $(git rev-parse --show-toplevel)'