Many says for security reasons the current directory is not in the $PATH
variable and Linux does not look in the current directory to see whether a specific command is available from that directory. but I did cd /usr/bin
then do ls
and it worked just fine; also I did echo $PATH
and the output contains /usr/bin
.
You should notice that for security reasons the current directory is not in the
$PATH
variable and Linux does not look in the current directory to see whether a specific command is available from that directory.Red Hat® RHCSATM/RHCE® 7 Cert Guide by Sander van Vugt
Why am I able to run ls
while being in /usr/bin
?
linux does not look in the current directory to see whether a specific command is available from that directory
That's true, but it does look in all directories mentioned in $PATH
, even though you might be in such a directory at that moment.
To word it in another way, if .
is not in your $PATH
, it doesn't matter where you are, it will always search the same directories to see whether a specific command is available there.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments