How to Change the Path Variable in Linux
Find the current path by typing "echo $PATH" at the bash shell prompt., Temporarily add the :/sbin and :/usr/sbin paths to the current path list by typing the following command at the bash shell prompt: uzair@linux:~$ export...
Step-by-Step Guide
-
Step 1: Find the current path by typing "echo $PATH" at the bash shell prompt.
A list of directories will be provided such as in the example below: uzair@linux:~$ echo $PATH/home/uzair/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/games Note:
Linux $PATH responds with ":" separators between entries. -
Step 2: Temporarily add the :/sbin and :/usr/sbin paths to the current path list by typing the following command at the bash shell prompt: uzair@linux:~$ export PATH=$PATH:/sbin/:/usr/sbin/
, uzair@linux:~$ echo $PATH/home/uzair/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games Remember, the above is only temporary and will be lost at reboot. ,, -
Step 3: Echo the contents of PATH to confirm the changes are reflected in the variable.
-
Step 4: Test application program operation with the temporary path to assure the all works well.
-
Step 5: Permanently change the path setting by adding the same line to your ~/.bashrc file
Detailed Guide
A list of directories will be provided such as in the example below: uzair@linux:~$ echo $PATH/home/uzair/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/games Note:
Linux $PATH responds with ":" separators between entries.
, uzair@linux:~$ echo $PATH/home/uzair/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games Remember, the above is only temporary and will be lost at reboot. ,,
About the Author
Isabella Chavez
Writer and educator with a focus on practical lifestyle knowledge.
Rate This Guide
How helpful was this guide? Click to rate: