The value of path is a series of directories that Linux searches for when you run a program. You can see the value of path with the following command.
$ echo $PATH
For example, in a host, the user Yogin path value is:
/opt/kde/bin:/usr/local/bin:/bin:/usr/bin:/usr/x11r6/bin:/home/yogin/bin
where ":" is the separator. So, a list of directories above can be considered as the directory listing below.
/opt/kde/bin
/usr/local/bin
/bin
/usr/bin
/usr/x11r6/bin
/home/yogin/bin
Also, in the host, the path value for user root is:
/opt/kde/bin
/sbin
/bin
/usr/sbin
/usr/bin
/usr/x11r6/bin
/root/bin
To modify the PATH value for all users, you can edit the/etc/profile file as root and modify the line that contains "path=".
For example, you can use the Pico Editor to open/etc/profile files.
$ pico-w/etc/profile
Pico is a text editor, and the-w option turns off long line wrapping functionality.
The new value for path will not take effect until the user registers again. If you only want to modify a user's path value, you should edit the. bash-profile file in the user's home directory.
If you want to add the current directory to the path, the. When you join the path, the path is set as follows:
Path= "$PATH:/usr/x11r6/bin:."
Export PATH
Note: After modifying the path value or any environment variable, export it with export and the new path value will not take effect.
*****************************************************************
Specific examples:
For example, to add the/etc/apache/bin directory to the path
1. #PATH = $PATH:/etc/apache/bin
Using this method, every time you log out of path, you will recover
2. #vi/etc/profile
Add path= $PATH in the appropriate location:/etc/apache/bin
This method is best, unless you force a manual modification of the value of path, otherwise it will not be changed
3. #vi ~/.bash_profile
Modify the path line to add/etc/apache/bin
This approach works for the user