Effortless Directory Navigation: `pushd` and `popd`

Quick Tip

Effortless Directory Navigation: `pushd` and `popd`

Challenge: You’re frequently switching between a few directories, and typing `cd` multiple times to go back and forth is becoming tedious and error-prone.

The Solution: Use the `pushd` and `popd` commands to manage a directory stack.

# To go to a directory and add it to the stack pushd /path/to/your/directory # To go back to the previous directory in the stack popd # To view the current directory stack dirs -v

Why it works: `pushd` not only changes your current directory but also adds the previous directory to a stack. `popd` then removes the top directory from the stack and returns you to it, creating an efficient way to jump between locations.

Pro-Tip: Use `pushd +N` to jump to the Nth directory in the stack (e.g., `pushd +2` jumps to the second directory).

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments