The command command in bash: Run command with arguments ignoring any shell function named command.

The -p option means to use a default value of $PATH that is guaranteed to find all of the standard utilities.

What exactly is the default PATH mentioned here? When I define export PATH="/home/ozgur/":$PATH, don't I add a new PATH path over the default value?

For example:

$ export PATH="/home/ozgur/":$PATH
$ echo $PATH
$ script.sh
hey, i am working !
$ command -p script.sh
hey, i am working !

When I used the -p option with the command command, I would expect it to ignore the new PATH path I had defined, but that didn't happen. What exactly am I missing here? What is the point of using the -p option if changes to the user's PATH path are not overridden?

  • 1
    I cannot reproduce this issue with bash v4.3.48. Sep 6, 2020 at 11:46

2 Answers 2


What exactly am I missing here?

The script.sh command is hashed. If you run hash -r, then command -p script.sh will fail as expected. But if you run it directly, it will be hashed again.

This really looks like a bug in bash -- it does not happen in other shells.


It sets up a basic PATH that bash calls STANDARD_UTILS_PATH - as of this ServerFault answer, the compile time default was:


You can also see the source on GNU Savannah.

  • Note that the user indicates that the script.sh command is not found in the standard path but is still executed with command -p script.sh. Their question is why it is executed, as it should not be found.
    – Kusalananda
    Nov 8, 2023 at 5:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .