Home Computer Tutorials Computer Knowledge [Recommended] Common methods to configure Linux environment variables!

[Recommended] Common methods to configure Linux environment variables!

Feb 19, 2024 pm 01:06 PM
export environment variables path

[Recommended] Common methods to configure Linux environment variables!

In Linux systems, environment variables are an important mechanism for storing information about the system's running environment. When we customize the installation of software, we usually need to configure environment variables. The following are several common methods for configuring Linux environment variables. I hope they will be helpful to you.

1. export PATH

Use the export command to directly modify the value of PATH and configure the method for MySQL to enter environment variables:

Export PATH=/home/uusama/mysql/bin:PATH# Or put PATH in front export
PATH=PATH:/home/uusama/mysql/bin

Precautions:

Effective time: Effective immediately

Validity period: Valid for the current terminal, invalid after the window is closed

Effective scope: only valid for the current user

Don’t forget to add the original configuration, that is, the $PATH part, to the configured environment variables to avoid overwriting the original configuration

 2.vim~/.bashrc

Configure by modifying the ~/.bashrc file in the user directory:

 vim~/.bashrc# Add export PATH=$PATH to the last line:/home/uusama/mysql/bin

Precautions:

Effective time: It will take effect when opening a new terminal with the same user, or manually source ~/.bashrc to take effect

Validity period: Valid forever

Effective scope: only valid for the current user

If there are subsequent environment variable loading files that overwrite the PATH definition, it may not take effect

 3. vim ~/.bash_profile

Similar to modifying the ~/.bashrc file, you also need to add a new path at the end of the file:

 vim ~/.bash_profile# Add export PATH=$PATH in the last line:/home/uusama/mysql/bin

Precautions:

Effective time: It will take effect when opening a new terminal with the same user, or manually source ~/.bash_profile

Validity period: Valid forever

Effective scope: only valid for the current user

The above is the detailed content of [Recommended] Common methods to configure Linux environment variables!. For more information, please follow other related articles on the PHP Chinese website!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Details on how to turn on environment variable settings on Windows 11 Details on how to turn on environment variable settings on Windows 11 Dec 30, 2023 pm 06:07 PM

The environment variable function is an essential tool for running the configuration program in the system. However, in the latest win11 system, there are still many users who do not know how to set it up. Here is a detailed introduction to the location of the win11 environment variable opening. Come and join us. Learn to operate it. Where are the win11 environment variables: 1. First enter "win+R" to open the run box. 2. Then enter the command: controlsystem. 3. In the system information interface that opens, select "Advanced System Settings" from the left menu. 4. Then select the "Environment Variables" option at the bottom of the "System Properties" window that opens. 5. Finally, in the opened environment variables, you can make relevant settings according to your needs.

Steps to set the PATH environment variable of the Linux system Steps to set the PATH environment variable of the Linux system Feb 18, 2024 pm 05:40 PM

How to set the PATH environment variable in Linux systems In Linux systems, the PATH environment variable is used to specify the path where the system searches for executable files on the command line. Correctly setting the PATH environment variable allows us to execute system commands and custom commands at any location. This article will introduce how to set the PATH environment variable in a Linux system and provide detailed code examples. View the current PATH environment variable. Execute the following command in the terminal to view the current PATH environment variable: echo$P

How to configure python environment variables in Win11? Tips for adding environment variables in win11python How to configure python environment variables in Win11? Tips for adding environment variables in win11python Feb 29, 2024 pm 04:30 PM

Win11 system is the latest Windows operating system, and users may encounter some configuration problems when using it. Among them, configuring Python environment variables is a common requirement because it allows users to easily use Python commands from any location. This article will introduce how to configure Python environment variables in Win11 system so that users can use the Python programming language more conveniently. 1. [Right-click] this computer on the desktop, and select [Properties] in the menu item that opens; 2. Then, under related links, find and click [Advanced System Settings]; 3. In the system properties window, click [Environment] at the bottom Variables]; 4. In the environment variables window, under system variables, select [Path], and then click

Windows 10 environment variable setting tutorial Windows 10 environment variable setting tutorial Jul 15, 2023 pm 06:09 PM

Environment variables are an important setting in the operating system, but some Windows 10 users still don’t know how to set environment variables. In fact, the method is very simple. Open the run window, call up the system characteristics window through the sysdm.cpl command, and then switch to the advanced tab. You will see a button for environment variables. Click this button to enter the setting of environment variables. interface, and then just set it up according to actual needs. How to set environment variables in Windows 10: 1. First open the run window on the computer, then enter sysdm.cpl in the window and press Enter. 2. Select Advanced in the system properties interface, and then click Environment Variables. 3. Here we can see the variables displayed, and we can create a new one on a single machine.

How to configure Tomcat environment variables How to configure Tomcat environment variables Oct 26, 2023 am 10:41 AM

To configure Tomcat environment variables, you need to add the CATALINA_HOME variable to the system and add the Tomcat installation path to the PATH variable. The steps in Windows are to first download and install Tomcat, open the system properties window, open the environment variable settings, add the Tomcat environment variable, modify the Path variable and verify the configuration. The steps in Linux are to first download and install Tomcat, open a terminal window, edit the bashrc file, add Tomcat environment variables, etc.

'The requested module does not provide an export named' Error appears in Vue Cli - how to solve it? 'The requested module does not provide an export named' Error appears in Vue Cli - how to solve it? Aug 20, 2023 pm 07:25 PM

'Therequestedmoduledoesnotprovideanexportnamed'Error appears in VueCli – how to solve it? During the development of the Vue project, we may encounter the error message 'Therequestedmoduledoesnotprovideanexportnamed'. This error message usually appears when introducing third-party components

How to solve the problem that Java environment variable configuration does not take effect How to solve the problem that Java environment variable configuration does not take effect Feb 19, 2024 pm 10:57 PM

How to solve the problem that Java environment variables do not take effect after configuration. During the Java development process, we often need to configure Java environment variables to ensure the normal operation of the program. However, sometimes we encounter some strange problems. Even if the Java environment variables are configured correctly, we find that the program does not run as configured. This is actually a common problem, and this article will introduce some solutions and provide specific code examples. The root cause of the problem is that the configuration of Java environment variables does not take effect correctly. Here are some common

How to set conda environment variables How to set conda environment variables Dec 05, 2023 pm 01:42 PM

Conda environment variable setting steps: 1. Find the installation path of conda; 2. Open the "System Properties" dialog box; 3. In the "System Properties" dialog box, select the "Advanced" tab, and then click the "Environment Variables" button; 4. In the "Environment Variables" dialog box, find the "System Variables" section, and then scroll to the "Path" variable; 5. Click the "New" button, and then paste the conda installation path; 6. Click "OK" to save the changes; 7. Verify whether the setting is successful.

See all articles