LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

pushd

Navigate directories using a stack

TLDR

Push directory to stack
$ pushd [/path/to/dir]
copy
Swap top two directories
$ pushd
copy
Push without changing directory
$ pushd -n [/path/to/dir]
copy
Show directory stack
$ dirs
copy
Pop from stack
$ popd
copy

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.

SEE ALSO

popd(1), dirs(1), cd(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid