Instantly Navigate Up the Directory Tree with `cd -`
Quick Tip
Instantly Navigate Up the Directory Tree with `cd -`
Challenge: You’re deep within a directory structure and need to quickly return to the parent directory or a previously visited directory without typing the full path.
The Solution: Use the `cd -` command.
cd -
Why it works: The `cd -` command is a shell shortcut that instantly navigates you to the directory that was previously in your `$PWD` environment variable. It’s like a quick “undo” for your directory changes.
Pro-Tip: Combine `cd -` with `pushd` and `popd` for an even more powerful directory stack manipulation. Type `pushd /path/to/new/dir` to add a directory to the stack and `popd` to return to the previous one.
Linux Tips & Tricks | © ngelinux.com | 5/15/2026
