Why can't I which pushd
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I've been using pushd
and popd
for a long time while writing bash script. But today when I execute which pushd
, I get nothing as output. I can't understand this at all. I was always thinking that pushd
is simply a command, just like cd
, ls
etc.
So why does which pushd
give me nothing?
which pushd
add a comment |Â
up vote
1
down vote
favorite
I've been using pushd
and popd
for a long time while writing bash script. But today when I execute which pushd
, I get nothing as output. I can't understand this at all. I was always thinking that pushd
is simply a command, just like cd
, ls
etc.
So why does which pushd
give me nothing?
which pushd
1
Related: How to distinguish between builtin and external util? (e.g. echo)
â steeldriver
Aug 8 at 1:16
Related: unix.stackexchange.com/q/85249/117549
â Jeff Schaller
Aug 8 at 1:17
Further to Jeff Schaller's note: observe that in some shellswhich pushd
does not yield nothing, but rather yieldspushd: shell built-in command
, and the premise of the question is wrong.
â JdeBP
Aug 8 at 10:26
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I've been using pushd
and popd
for a long time while writing bash script. But today when I execute which pushd
, I get nothing as output. I can't understand this at all. I was always thinking that pushd
is simply a command, just like cd
, ls
etc.
So why does which pushd
give me nothing?
which pushd
I've been using pushd
and popd
for a long time while writing bash script. But today when I execute which pushd
, I get nothing as output. I can't understand this at all. I was always thinking that pushd
is simply a command, just like cd
, ls
etc.
So why does which pushd
give me nothing?
which pushd
which pushd
asked Aug 8 at 1:12
Yves
809416
809416
1
Related: How to distinguish between builtin and external util? (e.g. echo)
â steeldriver
Aug 8 at 1:16
Related: unix.stackexchange.com/q/85249/117549
â Jeff Schaller
Aug 8 at 1:17
Further to Jeff Schaller's note: observe that in some shellswhich pushd
does not yield nothing, but rather yieldspushd: shell built-in command
, and the premise of the question is wrong.
â JdeBP
Aug 8 at 10:26
add a comment |Â
1
Related: How to distinguish between builtin and external util? (e.g. echo)
â steeldriver
Aug 8 at 1:16
Related: unix.stackexchange.com/q/85249/117549
â Jeff Schaller
Aug 8 at 1:17
Further to Jeff Schaller's note: observe that in some shellswhich pushd
does not yield nothing, but rather yieldspushd: shell built-in command
, and the premise of the question is wrong.
â JdeBP
Aug 8 at 10:26
1
1
Related: How to distinguish between builtin and external util? (e.g. echo)
â steeldriver
Aug 8 at 1:16
Related: How to distinguish between builtin and external util? (e.g. echo)
â steeldriver
Aug 8 at 1:16
Related: unix.stackexchange.com/q/85249/117549
â Jeff Schaller
Aug 8 at 1:17
Related: unix.stackexchange.com/q/85249/117549
â Jeff Schaller
Aug 8 at 1:17
Further to Jeff Schaller's note: observe that in some shells
which pushd
does not yield nothing, but rather yields pushd: shell built-in command
, and the premise of the question is wrong.â JdeBP
Aug 8 at 10:26
Further to Jeff Schaller's note: observe that in some shells
which pushd
does not yield nothing, but rather yields pushd: shell built-in command
, and the premise of the question is wrong.â JdeBP
Aug 8 at 10:26
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
3
down vote
accepted
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
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
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
add a comment |Â
up vote
3
down vote
accepted
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
add a comment |Â
up vote
3
down vote
accepted
up vote
3
down vote
accepted
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
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
edited Aug 8 at 1:40
answered Aug 8 at 1:33
slmâ¦
238k65491662
238k65491662
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f461184%2fwhy-cant-i-which-pushd%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
Related: How to distinguish between builtin and external util? (e.g. echo)
â steeldriver
Aug 8 at 1:16
Related: unix.stackexchange.com/q/85249/117549
â Jeff Schaller
Aug 8 at 1:17
Further to Jeff Schaller's note: observe that in some shells
which pushd
does not yield nothing, but rather yieldspushd: shell built-in command
, and the premise of the question is wrong.â JdeBP
Aug 8 at 10:26