Operating systems usually use environment variables to define global settings or to control the operation of programs. The Path variable is one of the environment variables and is constantly used without your knowledge. The variable stores a list of directories where executable files are located.
Step 1. Find the current path by entering the echo $ PATH command
A directory listing will open as shown below (example):
- uzair @ linux: ~ $ echo $ PATH / home / uzair / bin: / usr / local / sbin: / usr / local / bin: / usr / bin: / bin: / usr / games
- Note: directories are separated by colons.
Step 2. Temporarily add:/ sbin and: / usr / sbin: to the current path by entering the command:
uzair @ linux: ~ $ export PATH = $ PATH: / sbin /: / usr / sbin /
Step 3. Enter the command to confirm that the PATH variable has been changed
- uzair @ linux: ~ $ echo $ PATH / home / uzair / bin: / usr / local / sbin: / usr / local / bin: / usr / sbin: / usr / bin: / sbin: / bin: / usr / games
- Remember that the changes you make are temporary and will be canceled when you reboot your system.
Step 4. Check the correct operation of programs with a temporary variable.
5 To make permanent changes to the PATH variable add the same line to the ~ /.bashrc file