Operating systems generally use environment variables to define various global settings that affect parts of the system, or to manage applications. The PATH variable is one of the environment variables, and is often used without the user's knowledge. This variable holds a list of directories that will be used by applications (especially shells) to search for commands.
Step
Step 1. Know the contents of the PATH variable by entering the command "echo $PATH" in the shell window
You will see a list of directories as in the following example:
- uzair@linux:~$ echo $PATH/home/uzair/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/games
- Note: the directory display in the $PATH variable is separated by ":".
Step 2. Add directory ":
/sbin" and ":/usr/sbin" temporarily to the PATH list with the following command:
uzair@linux:~$ export PATH=$PATH:/sbin/:/usr/sbin/
Step 3. Display the contents of the PATH variable to confirm that the change has taken place
- uzair@linux:~$ echo $PATH/home/uzair/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
- Keep in mind that the above changes are only temporary and will disappear when the computer restarts.