Linux environment variable configuration

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

  1. When using environment variables, start with a $ sign . (use echo $PATH to see the contents of the PATH variable)
  2. Each directory is separated by a "semicolon" .

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326196578&siteId=291194637