Bash - popd (Builtin command)

Bash Liste Des Attaques Ovh

About

popd removes entries from the directory stack. See dirs.

Syntax

With no arguments, removes the top directory from the stack, and performs a cd to the new top directory.

popd [-n] [+n] [-n]

where:

  • +n - Removes the nth entry counting from the left of the list shown by dirs, starting with zero.
  • -n - Removes the nth entry counting from the right of the list shown by dirs, starting with zero.
  • -n - Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated.

Return value

If the popd command is successful, a dirs is performed as well, and the return status is 0.

popd returns false if:

  • an invalid option is encountered,
  • the directory stack is empty,
  • a non-existent directory stack entry is specified,
  • or the directory change fails.

Example

  • popd +0 removes the first directory,
  • popd +1 the second.
  • popd -0 removes the last directory
  • popd -1 the next to last.

Go away and returns

# we are now in /
pushd /aDir/
# we are now in /aDir/
popd
# we are now back in the starting current directory /





Discover More
Bash Liste Des Attaques Ovh
Bash - Builtin Commands

builtin refers to: a builtin command. See or to the specific builtin command. See (useful when defining a function whose name is the same as a shell builtin) The builtin command execute the specified...
Bash Liste Des Attaques Ovh
Bash - Directory stack

The directory stack permits to navigate and come back in the directory tree. Directories are added to the list with the pushd command; See pushd The popd command removes entries from...



Share this page:
Follow us:
Task Runner