Where is the linux environment variable path?

尊渡假赌尊渡假赌尊渡假赌
Release: 2023-07-05 18:03:39
Original
3798 people have browsed it

The Linux environment variable path is stored in the user's configuration file, usually a hidden file located in the user's home directory, named ".bashrc" or ".bash_profile". These files contain the configuration files loaded when the user logs in. Environment variables and other configuration information.

Where is the linux environment variable path?

The operating system of this tutorial: Linux5.18.14 system, Dell G3 computer.

In Linux systems, the environment variable PATH is stored in the user's configuration file.Specifically, it is usually located in a hidden file in the user's home directory, named .bashrc or .bash_profile. These files contain environment variables and other configuration information that are loaded when the user logs in.

The user’s profile path is as follows:

  • For ordinary users: ~/.bashrc or ~/.bash_profile

  • For root users: /root/.bashrc or /root/.bash_profile

You can use a text editor (such as vi, nano, etc.) to open the corresponding file, view and edit the PATH environment variable . The sample command is as follows:

vi ~/.bashrc
Copy after login

In the opened file, you can find lines similar to the following to set the PATH variable:

export PATH=/usr/local/bin:/usr/bin:/bin
Copy after login

This is a simple example, changing the three paths /usr/ local/bin, /usr/bin and /bin are added to the PATH variable. You can edit this line as needed and add the required paths to the PATH variable, separated by colons.

After editing and saving, execute the following command to make the modification effective:

source ~/.bashrc
Copy after login

By performing the above operations, you can find and modify the PATH environment variable in the user's configuration file to suit your needs.

The above is the detailed content of Where is the linux environment variable path?. 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
Latest Articles by Author
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!