Instantly Navigate Up: `cd -` Shortcut
Quick Tip
Instantly Navigate Up: `cd -` Shortcut
Challenge: You’re deep in a directory structure and need to quickly return to the previous directory you were in, without having to type out the full path or use `cd ../../..` repeatedly.
The Solution: Use the `cd -` command.
cd -
Why it works: The shell keeps track of your current directory and the previous directory. `cd -` toggles between these two directories, effectively taking you “back” to where you were.
Pro-Tip: Combine `cd -` with `pushd` and `popd` for an even more powerful directory stack management. `pushd new_directory` adds the current directory to the stack and changes to `new_directory`, while `popd` removes the top directory from the stack and returns to it.
Linux Tips & Tricks | © ngelinux.com | 6/7/2026
