We know that the instructions for checking the properties of a file ls the full file name:/bin/ls (This is the absolute path), so why is it possible to execute the/BIN/LS command from anywhere? Why is it possible to enter LS in any directory to display some information without saying that the/BIN/LS directive cannot be found? This is because of the environment variable PATH!
When we execute an instruction, such as LS, the system will search for an executable file named LS according to the directory defined by path, and if there is more than one executable file named LS in the directory defined by path, then the first command to search for the same name is executed first!
Echo $PATH
PATH (must be uppercase) the contents of this variable are composed of a bunch of directories, each of which is separated by a colon (:), and each directory is in order. Take a closer look at the above output, you can find that both root and Vbird have/bin this directory in the PATH variable, so it is necessary to be able to perform LS lookup anywhere/bin/ls execution!