CentOS common experience and skills summary

1. Add path to environment variable

Adding paths to environment variables under CentOS varies according to permissions and other settings, generally divided into the following three:
(1) Effective for the current session
Direct execution export PATH=$PATH:/usr/local/python3/binwill add the path to the environment variable, but it will only take effect for the current session. When logging out or logging out of the system, the added PATH will become invalid and restore to the original configuration.
(2)
Take effect for the current user At this time ~/.bash_profile, you need to edit , execute the vim ~/.bash_profileedit file first , add it at the end of the text export PATH=$PATH:/usr/local/python3/bin, save and exit and execute source ~/.bash_profileto make the environment variable take effect. This operation takes effect for the current user.
(3)
Take effect for all users At this time /etc/profile, you need to edit , first execute the vim /etc/profileedit file, add it at the end of the text export PATH=$PATH:/usr/local/python3/bin, save and exit and execute source /etc/profileto make the environment variable take effect. This operation is effective for all users.

The latter two methods can be used echo $PATHto check whether the modification is successful.

Guess you like

Origin blog.csdn.net/CUFEECR/article/details/109700487