Site icon New Generation Enterprise Linux

Effortless Directory Hopping with `cd -`

Quick Tip

Effortless Directory Hopping with `cd -`

Challenge: Frequently navigating back and forth between your current directory and the previous one can be tedious, requiring you to remember or retype full paths.

The Solution: Use the `cd -` command to instantly switch to your previous directory.

cd -

Why it works: The shell maintains a history of visited directories. `cd -` specifically toggles between the current directory and the last directory listed in that history, effectively acting as a “back” button for your terminal navigation.

Pro-Tip: Combine `cd -` with `pushd` and `popd` for managing multiple directory stacks, allowing you to jump between even more locations with ease.

Linux Tips & Tricks | © ngelinux.com | 5/19/2026

0 0 votes
Article Rating
Exit mobile version