Linux Paths and Navigation Cheat Sheet/Push and change directory

Change directory and push previous one onto stack.

Section: Directory Stack

Push and change directory

bash
bash
pushd /etc/nginx

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Directory Stack
Return to previous stacked directory
Pop top directory from stack and change to it.
OpenIn sheetbashsame section
Clear directory stack
Remove entries from shell directory stack.
OpenIn sheetbashsame section
Show current path via shell variable
Print current directory using shell state.
Match text files
Expand shell glob to files ending in .txt.
Iterate over files safely
Use NUL delimiters for filenames with spaces/newlines.
Get basename
Extract the last path component.