Site icon New Generation Enterprise Linux

Effortless Directory Hopping with `cd -`

Quick Tip

Effortless Directory Hopping with `cd -`

Challenge: You frequently navigate back and forth between two directories and find yourself typing long paths repeatedly.

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

cd -

Why it works: The shell keeps track of your current working directory and the previous one. `cd -` is a shortcut to toggle between these two locations.

Pro-Tip: For managing multiple directories in your history, consider using `pushd` and `popd` for a directory stack.

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

0 0 votes
Article Rating
Exit mobile version