There are two ways to set environment variables:
1, add to the environment variable path $PATH
# Add to the end of PATH export PATH= $PATH :/path/to/your/dir
# Add to the beginning of PATH export PATH= /path/to /your/dir : $PATH
2, name a new band environment variable
Environment variables usually have three scopes:
1. Current terminal : export CLASS_PATH=./JAVA_HOME/lib: $JAVA_HOME/jre/lib
2. Current user : write to the .bashrc
file in the user's home directory
vim ~/.bashrc
export CLASS_PATH=./JAVA_HOME/lib:$JAVA_HOME/jre/lib
Logout or restart can make the changes take effect, if you want to make the added environment variables take effect immediately
source ~/.bashrc
3. All users : modify the profile
file
sudo vim /etc/profile
export CLASS_PATH=./JAVA_HOME/lib:$JAVA_HOME/jre/lib
source /etc/profile
Vim editor
After entering the editor, we first press "I" to switch to the "Insert" state. You can edit the content by moving the cursor up, down, left and right, or spaces, backspaces, and carriage returns, which is the same as WINDOWS.
When text editing is complete, it is usually necessary to exit the editor. There are 4 cases to exit the editor: save and exit, normal exit, unsaved exit and forced exit. Just say it below!
Save and exit Esc+: +wq!
Esc + X
After pressing ESC, press shift+zz directly, or switch to uppercase mode and press ZZ, you can save and exit, that is, press the uppercase Z twice.
Normal exit Esc + : +q + !