Online majorityArticleContent:
(For example, add/sbin to the path environment variable)
(1) If you only want to add temporary modifications during the current Boot Process, the next boot will be invalid, you can:
Enter export Path = $ path:/sbin
(2) If only the current user is permanently added:
In ~ /.In bash_profile, a line similar to this path = $ path: $ home/bin is added near the end, and then it becomes Path = $ path: $ home/bin:/sbin.
Run source ~ /. Bash_profile command to make the modification take effect immediately
(3) If all users in the system are permanently added:
Add export Path = $ path:/sbin at the end of the/etc/profile file
After the file is modified and maintained, run the source/etc/profile command to make the modification take effect immediately.
In fact, the source/etc/profile command takes effect immediately in the current shell. If a new shell is opened, the $ path of the new shell is not added to the new path. Only after restart.
/Etc/profile:
For I in/etc/profile. d/*. Sh; do
If [-R "$ I"]; then
. $ I
Fi
Done
Echo Path = $ path:/sbin --- add this
Unset I
Unset pathmunge
PS:
Test in RedHat as4 environment.