Linux environment variables are stored in the "/etc/environment" file. This file is a plain text file that can be used to set global environment variables of the system. User-level environment variables are stored in the user's home directory. In a hidden file, the specific path is "~/.bashrc", "~/.bash_profile" or "~/.profile", depending on the shell used and the system configuration.
The operating system of this tutorial: Linux5.18.14 system, Dell G3 computer.
In the Linux environment, system-level environment variables are usually saved in the /etc/environment file. This file is a plain text file that can be used to set global environment variables of the system.
User-level environment variables are stored in a hidden file in the user's home directory. The specific path is ~/.bashrc, ~/.bash_profile or ~/.profile, depending on the use shell and system configuration.
Among them, .bashrc is the configuration file of Bash shell, and .bash_profile is also the configuration file of Bash shell, but it is executed once at login. .profile is a general shell configuration file, suitable for many types of shells.
If you want to set environment variables for a specific user, you can edit the corresponding user configuration file and add the corresponding environment variable settings in the file.
In short, in the Linux environment, system-level environment variables are stored in the /etc/environment file, and user-level environment variables are stored in the .bashrc, .bash_profile or .profile file in the user's home directory. .
The above is the detailed content of In which folder are linux environment variables saved?. For more information, please follow other related articles on the PHP Chinese website!