popd
and pushd
are commands built into Bash, they're not actual executables that live on your HDD as true binaries.
excerpt bash man page
DIRSTACK
An array variable (see Arrays below) containing the current
contents of the directory stack. Directories appear in the stack
in the order they are displayed by the dirs builtin. Assigning to
members of this array variable may be used to modify directories
already in the stack, but the pushd and popd builtins must be used
to add and remove directories. Assignment to this variable will
not change the current directory. If DIRSTACK is unset, it loses
its special properties, even if it is subsequently reset.
The full list of all the builtin commands is available in the Bash man page as well as here - http://structure.usc.edu/bash/bashref_4.html.
You can also use compgen -b
or enable
to get a full list of all these builtins:
compgen
$ compgen -b | grep -E "^push|^pop"
popd
pushd
enable
$ enable -a | grep -E "\bpop|\bpus"
enable popd
enable pushd
Additionally if you want to get help on the builtins you can use the help
command:
$ help popd | head -5
popd: popd [-n] [+N | -N]
Remove directories from stack.
Removes entries from the directory stack. With no arguments, removes
the top directory from the stack, and changes to the new top directory.
$ help pushd | head -5
pushd: pushd [-n] [+N | -N | dir]
Add directories to stack.
Adds a directory to the top of the directory stack, or rotates
the stack, making the new top of the stack the current working
which pushd
does not yield nothing, but rather yieldspushd: shell built-in command
, and the premise of the question is wrong. – JdeBP Aug 08 '18 at 10:26