Answer the question
In order to leave comments, you need to log in
Where in Linux are the basic commands available without the PATH environment variable defined?
After overwriting the PATH variable, I thought /bin was checked by default.
As it turned out, the echo and pwd commands (both in /bin) remain available, but cat, which is also located in /bin, becomes unavailable
How sh finds echo and pwd without specifying the full path to them with an empty PATH environment variable and where you can see the full list commands available under this condition?
PS If there are any links to more advanced books / sources on the topic, I will also be grateful.
Answer the question
In order to leave comments, you need to log in
Linux does not look for any commands if PATH is empty. The search for external executable files is ONLY in the directories that are registered in the PATH.
In Windows, the current directory is always checked beforehand, in addition, there are a lot of aliases through like dosset and the registry
in Linux, commands can be:
built into the shell (pwd, echo)
alias, which can refer to an external program
External files that are in folders specified in PATH
you can find out which command is internal or external using the type command or which:
$ type type
type is a shell builtin
$ type which
which is /usr/bin/which
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question