Seamlessly Jump Between Directories with `pushd` and `popd`
Quick Tip
Seamlessly Jump Between Directories with `pushd` and `popd`
Challenge: You frequently navigate back and forth between several directories, often losing track of where you came from or having to retype long paths.
The Solution: Utilize the `pushd` and `popd` commands to manage a directory stack.
pushd /path/to/directory1 pushd /path/to/another/directory # ... work in current directory ... popd 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 returns you to it, effectively reversing the `pushd` operation.
Pro-Tip: Type `dirs` to view the current directory stack.
Linux Tips & Tricks | © ngelinux.com | 5/6/2026
