Modify the profile file and add the executable file to the system for global availability.
- Method 1: (temporarily effective)
Use export PATH=$ PATH: <directory name> to increase the environment variable. (eg export PATH=$ PATH: /root/jdk/bin)
- Method 2: (Permanently valid only for the current user)
Modify the bash_profile file in the user directory. (eg PATH=$PATH/bin:$HOME/root/bin)
- Method 3: (permanently effective for all users)
Modify the profile file in the etc directory, and then use source profile or ./profile to make environment variables take effect. (Same as example 2)
Environment Variable Format Features
- When using environment variables, start with a $ sign . (use echo $PATH to see the contents of the PATH variable)
- Each directory is separated by a "semicolon" .