Site icon New Generation Enterprise Linux

Seamlessly Jump Between Parent Directories

Quick Tip

Seamlessly Jump Between Parent Directories

Challenge: You’re deep in a directory structure and need to quickly navigate back to the parent directory you were just in.

The Solution: Utilize the `pushd` and `popd` commands.

pushd /path/to/your/directory # ... do some work ... cd .. # ... do more work ... pushd # This will take you back to the previous directory 

Why it works: `pushd` adds the current directory to a directory stack and then changes to the specified directory. `popd` removes the top directory from the stack and changes to it, effectively allowing you to ‘undo’ a directory change.

Pro-Tip: Type `dirs` to see your current directory stack.

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

0 0 votes
Article Rating
Exit mobile version