Configure environment variables in linux

1. The role of environment variables

Environment variables are some key information recorded by the operating system when it is running, and are used to assist the operation of the system.
Execute the command in linux evnto view the environment variables recorded in the current system.
Environment variables are a KeyValue structure
insert image description here

2. Symbol $

In the Linux system, $ is used to get the value of "variable".
The value of the environment variable can be obtained through the syntax: $environment variable name
For example:echo $PATH
insert image description here

3. Configure environment variables in linux

[1] Set environment variables by yourself

  • Temporary setting syntax:export 变量名=变量值
  • Take effect permanently
    1. To take effect for the current user, configure it in the current user's ~/bashrc file
    2. To take effect for all users, configure it in the system's /etc/profile file
    3. Use the syntax sourcr to configure the file to take effect immediately, or restart Log in to finalshell to take effect

Guess you like

Origin blog.csdn.net/weixin_46268244/article/details/129291587