How to Change the Path Variable in Linux
How to Change the Path Variable in Linux
Operating systems commonly use environment variables to define various global settings for parts of your operating system or to control how applications run. The PATH variable is one of these environment variables and is constantly used without the user realizing it. The variable stores a list of directories where applications (most commonly, your shell) should look for a program whenever you run it as a command.
Steps

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.

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/

Echo the contents of PATH to confirm the changes are reflected in the variable. 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.

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

Permanently change the path setting by adding the same line to your ~/.bashrc file

What's your reaction?

Comments

https://rawisda.com/assets/images/user-avatar-s.jpg

0 comment

Write the first comment for this!