Quick Tip
Quickly Jump to Directory Parent with `cd -`
Challenge: You’re working deep in a directory structure and frequently need to hop back to the immediate parent directory to perform a task, only to return to your current location. Manually typing the full path can be tedious and error-prone.
The Solution: Use the `cd -` command to instantly switch to the previous directory.
cd -
Why it works: The shell keeps track of your current and previous working directories. `cd -` is a shortcut that tells the shell to change to the directory stored in the `$OLDPWD` environment variable, which is the directory you were in before the last `cd` command.
Pro-Tip: You can press `Ctrl+G` in some shells (like Zsh with certain plugins) to see your current directory path and then use a command like `cd ../../` to go up multiple levels, but `cd -` is unmatched for a single hop back and forth.
Linux Tips & Tricks | © ngelinux.com | 4/27/2026
