Linux environment variables related

View PATH: echo PATH to add mongodbserver as column Modification method one: export PATH = / usr / local / mongodb / bin: PATH to add mongodb server as column Modification method 1: export PATH=/usr/local/mongodb/bin:P A T H to add plus m O n- G O D B S E R & lt V E R & lt as column repair modified square method a : E X P O R & lt T P A T H=/usr/local/mongodb/bin: PATH
//After configuration, you can view the configuration result through echo $PATH.
Effective method: effective immediately Effective
period: temporary change, only effective in the current terminal window, the original path configuration will be restored after the current window is closed
User limitation: only for the current user

Modification method two:
by modifying the .bashrc file:
vim ~/.bashrc
// Add in the last line:
export PATH=/usr/local/mongodb/bin:$PATH
Effective method: (there are the following two)
1. Close the current terminal Window, reopen a new terminal window to take effect
2. Enter the "source ~/.bashrc" command, it will take effect immediately.
Validity period: permanently valid.
User limitation: only for the current user

Modification method 3:
by modifying the profile file:
vim /etc/profile
/export PATH //Find the line that sets the PATH, and add
export PATH=/usr/local/mongodb/bin:$PATH
Effective method: system restart
Effective period: permanent effective
User limitations: for all users

Modification method 4:
by modifying the environment file:
vim /etc/environment
in PATH=``/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr Add ":/usr/local/mongodb/bin" to "/games:/usr/local/games"
Effective method: system restart
Validity period: Permanently effective
User limitation: for all users

Guess you like

Origin blog.csdn.net/qq_39109226/article/details/110261631