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.
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
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
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
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!