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

In which folder are linux environment variables saved?

尊渡假赌尊渡假赌尊渡假赌
Release: 2023-07-06 17:52:05
Original
5934 people have browsed it

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template