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
![Change the Path Variable in Linux Step 1 Change the Path Variable in Linux Step 1](https://i.how-what-advice.com/images/009/image-25316-1-j.webp)
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 ":".
![Change the Path Variable in Linux Step 2 Change the Path Variable in Linux Step 2](https://i.how-what-advice.com/images/009/image-25316-2-j.webp)
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/
![Change the Path Variable in Linux Step 3 Change the Path Variable in Linux Step 3](https://i.how-what-advice.com/images/009/image-25316-3-j.webp)
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.
![Change the Path Variable in Linux Step 4 Change the Path Variable in Linux Step 4](https://i.how-what-advice.com/images/009/image-25316-4-j.webp)
Step 4. Try running the app which is in the new PATH to make sure your changes are not causing any problems
![Change the Path Variable in Linux Step 5 Change the Path Variable in Linux Step 5](https://i.how-what-advice.com/images/009/image-25316-5-j.webp)