Site icon New Generation Enterprise Linux

Instantly Jump Between Directories with `pushd` and `popd`

Quick Tip

Instantly Jump Between Directories with `pushd` and `popd`

Challenge: You frequently navigate between a few key directories and find yourself typing `cd` commands repeatedly.

The Solution: Use the `pushd` and `popd` commands to maintain a stack of directories.

# Navigate to a directory and add it to the stack pushd /path/to/your/project # Navigate to another directory pushd /var/log # Jump back to the previous directory in the stack popd # Jump back to the directory before that popd

Why it works: `pushd` adds the current directory to a stack and then changes to the specified directory. `popd` removes the top directory from the stack and changes to it, effectively moving you back to where you were.

Pro-Tip: Type `dirs` to view the directory stack.

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

0 0 votes
Article Rating
Exit mobile version