Add ":/usr/local/bin" to PATH="/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin" in vim /etc/environment # The path that needs to be added, Add: separated in front Effective method: System restart Expiry date: Permanently valid User limitation: For all users
View environment variables: echo $PATH
or:
(Only valid for the current user permanently)
Set environment variables
(1) Open the configuration file
Run the following command:
$ gedit ~/.bashrc
(2) Add command
Add the following command at the end of the file:
export PATH=$PATH:/usr/local/go/bin
export GOPATH=/home/gopath
(3) The order takes effect
run the following command
$ source ~/.bashrc
---------------------------------------------------------------------------------------------------------------------------
centos system
vi /etc/profile
Add the following two lines of code at the end of the file
PATH=/usr/local/webserver/php/bin:$PATH
export PATH
PS: /usr/local/webserver/php/bin is the bin path that needs to be added, separated by colons:
If the modification just now takes effect immediately, you need to execute the following code
source /etc/profile
echo $PATH view
Expiry date: permanent
User Limitation: For all users