Stealthy Directory Navigation with `pushd` and `popd`
Quick Tip
Stealthy Directory Navigation with `pushd` and `popd`
Challenge: Constantly navigating back and forth between different directories can be cumbersome, often requiring you to remember or retype long paths.
The Solution: Use the `pushd` and `popd` commands to manage a directory stack.
pushd /path/to/directory1 # Now you are in directory1 pushd /another/path # Now you are in /another/path popd # You are back in directory1 popd # You are back in your original directory
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 letting you cycle through previously visited directories.
Pro-Tip: Running `dirs` will show you the current directory stack.
Linux Tips & Tricks | © ngelinux.com | 5/15/2026
