PATH variable is one of the most important concepts of any operating system. PATH variable tells the places from where the Operating System(OS) will search for whenever a command is given. Lets explain it a bit in detail.
Say, we fire the ls command. Once the ls command is executed, all the files and directories in the current directory are displayed. What happened now in order for the OS to display the files and directories?
When the ls command is executed, the OS starts searching for an executable named ls. Where does it search? It searches in all the directories mentioned in the PATH variable. The moment it finds the executable, it executes the command the the output is displayed.
[XXX : ~gpr]# echo $PATH
The above PATH variable tells that whenever a command is given, the OS will search for the command in the /bin directory first, followed by the /usr/bin directory.
Sometimes, when we give a well known command, we get the 'command not found' error. This error occurs usually whenever the PATH variable is corrupted. When the OS started searching for the ls command, it did not find the executable in any of the directories defined in the PATH variable and hence the error 'command not found'.
This can be corrected by updating the PATH variable with the /usr/bin directory.
The above expression states to append the /usr/bin directory to the existing PATH variable.