Working on the Linux command line: How to efficiently navigate up

Posted . Visible to the public. Repeats.

With cd .. you can navigate one directory up from the one you are at now. If you use that a lot, consider some handy aliases.

Add the following lines to your ~/.bashrc:

alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ......="cd ../../../../.."

you can add even more aliases, but I usually loose track after too many levels and just jump to the directly directly, e.g. using its absolute path or its bookmark (see this card).

Example usage:

>pwd
/home/judith
>cd Projects/makandra-cards/
./Projects/makandra-cards/
>pwd
/home/judith/Projects/makandra-cards
>...
>pwd
/home/judith

This will be most helpful if you are forced to work in deeply nested directories (e.g. projects with such a structure).

Profile picture of Judith Roth
Judith Roth
Last edit
Niklas Hasselmeyer
License
Source code in this card is licensed under the MIT License.
Posted by Judith Roth to makandra dev (2021-09-17 17:17)