What is the purpose of the PATH variable'?'
In UNIX / Linux file systems, the human-readable address of a resource is...
In UNIX / Linux file systems, the human-readable address of a resource is defined by PATH. It is an environmental variable 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. It increases both the convenience and the safety of such operating systems and is widely considered to be the single most important environmental variable. Environmental variables are a class of variables.
U can use the command like: env | grep PATH
When you type a command into the shell, the shell needs to find that program....
When you type a command into the shell, the shell needs to find that program. If you say "/bin/ls" then the shell goes to the /bin directory to find it. If you just say "ls" then it needs to look for it. There are too many places it could be, and possibly multiple things with that name, so you must give the shell a list of places to look. That list is the PATH variable. The PATH variable is a list of directories, separated by the colon character. The shell looks in those directories, in order, to find the command you just typed.
It is needed to both allow the shell to find a command and to direct the shell to the version of the command you want it to choose, sometimes.
You can see the value of your PATH variable by doing "echo $PATH". In teh BASH shell, the most common on on Linux, you can add a new directory to your PATH variable like so: PATH=/home/kevin/bin:$PATH
Now each time I type a command name without specifying a directory, the shell will first look in /home/kevin/bin. If you want the shell to look for a command in the directory you happen to be in at the time you type the command, then include "." as a directory in the PATH. For example,
Now the shell will first look in the directory you are in before any other.
When you use system variables, you make a lot of things easier. ...
When you use system variables, you make a lot of things easier.
First of all, when you make a change in the system like changing the Java which you use, you do not have to update every program that use Java. it just check it with JAVA_HOME system variable.
And, the PATH variable has the paths to every binary you use in your system, so when you are in a terminal you do not have to input /bin/ls, just ls