pushd
Navigate directories using a stack
TLDR
SYNOPSIS
pushd [options] [dir]
DESCRIPTION
pushd is a shell built-in that changes the current directory while saving the previous directory on a stack. This allows quick navigation between multiple working directories without needing to remember or retype full paths.When called with a directory argument, pushd changes to that directory and pushes the old directory onto the stack. Called without arguments, it swaps the top two directories on the stack. The -n flag adds a directory to the stack without actually changing to it. Use dirs to view the current stack contents, popd to return to the previous directory, and +N or -N notation to rotate to specific stack positions.
PARAMETERS
DIR
Directory to push.-n
Add without changing.+N
Rotate Nth entry (from left) to top.-N
Rotate Nth entry (from right) to top.
CAVEATS
Shell built-in. Works with popd and dirs.
HISTORY
pushd originated in the C shell (csh) and was adopted by bash, zsh, and other shells as a built-in command for directory stack management.
