LinuxCommandLibrary

pushd

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 pushes directory onto stack. Directory navigation tool.
The tool enables quick directory switching. Shell built-in.
pushd saves directories.

PARAMETERS

DIR

Directory to push.
-n
Add without changing.
+N
Rotate to Nth entry.
-N
Rotate to Nth from end.

CAVEATS

Shell built-in. Works with popd and dirs.

HISTORY

pushd is a shell built-in for directory stack management.

SEE ALSO

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

Copied to clipboard