Quick Tip
Effortless Directory Hopping with `pushd` and `popd`
Challenge: Frequently navigating between a few specific directories can be cumbersome, requiring repeated typing of `cd` commands.
The Solution: Utilize the `pushd` and `popd` shell built-ins to create a directory stack and easily switch between them.
# Navigate to a directory and push it onto the stack pushd /path/to/project1 # Navigate to another directory, it gets added to the stack too pushd /path/to/another/dir # Quickly jump back to the previous directory popd # To see the current directory stack dirs
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, allowing for efficient backtracking and switching.
Pro-Tip: You can push multiple directories at once with `pushd dir1 dir2 dir3` and then use `popd` multiple times to cycle through them.
Linux Tips & Tricks | © ngelinux.com | 5/22/2026
