Site icon New Generation Enterprise Linux

Instant Directory Hopping with `cd -`

Quick Tip

Instant Directory Hopping with `cd -`

Challenge: You’re working in a directory, need to quickly access a file or perform a task in a previous directory, and then immediately return to your original location without manually navigating back.

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

cd -

Why it works: The shell keeps track of your current and previous working directories. `cd -` leverages this built-in functionality to toggle between these two locations efficiently.

Pro-Tip: For even more powerful directory management, explore `pushd` and `popd` to maintain a stack of directories you’ve visited.

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

0 0 votes
Article Rating
Exit mobile version