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...

5 Steps 1 min read Medium

Step-by-Step Guide

  1. 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.
  2. 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. ,,
  3. Step 3: Echo the contents of PATH to confirm the changes are reflected in the variable.

  4. Step 4: Test application program operation with the temporary path to assure the all works well.

  5. 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

I

Isabella Chavez

Writer and educator with a focus on practical lifestyle knowledge.

65 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: