Home  >  Article  >  Operation and Maintenance  >  In which folder are linux environment variables saved?

In which folder are linux environment variables saved?

尊渡假赌尊渡假赌尊渡假赌
尊渡假赌尊渡假赌尊渡假赌Original
2023-07-06 17:52:055738browse

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.

In which folder are linux environment variables saved?

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn