When I type this in sh it outputs :
$ $PATH
sh: 12: /bin:/usr/bin: not foundBut, I do have a /usr/bin folder, and it's fuuuuull of stuff.
Same thing with zsh:
▶ $PATH
zsh: no such file or directory: /bin:/usr/binWhat the hell ? How do I fix this ?
41 Answer
PATH is an environmental variable in Linux and other Unix-like operating systems that tells the shell which directories to search for executable files (i.e., ready-to-run programs) in response to commands issued by a user.
To see the value of PATH variable, do it as echo $PATH. In your case, sh will look for executable in /bin and /usr/bin directory.
Also, you can use your sh commands as /bin/command if the executable of command is in the /bin directory. For example, instead of using ls you can use /bin/ls since writing ls runs the executable ls present in /bin. If the ls is not there in /bin, then it will look in /usr/bin. If ls is still not found in both the directory, then it will complain.
Trying to use $PATH or /bin:/usr/bin: directly, sh thinks that it is supposed to run bin executable located in the directory /bin:/usr/. This is the reason, it give directory or file not found or not found error.
For detailed info on PATH.
2