search
HomeComputer TutorialsComputer Knowledge[Recommended] Common methods to configure Linux environment variables!

[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
This article is reproduced at:每日运维. If there is any infringement, please contact admin@php.cn delete
[Resolved] Error Code 0x8004deea – OneDrive Can't Sync Issue - MiniTool[Resolved] Error Code 0x8004deea – OneDrive Can't Sync Issue - MiniToolMay 04, 2025 am 12:50 AM

Have you ever encountered the OneDrive can’t sync issue? This issue is often accompanied by some error codes for different reasons. This article on php.cn Website will develop around the error code 0x8004deea and give you some useful methods to get r

What Is Wireshark? How to Download Wireshark/Install for Windows? - MiniToolWhat Is Wireshark? How to Download Wireshark/Install for Windows? - MiniToolMay 04, 2025 am 12:49 AM

What is Wireshark? Is Wireshark safe? How to download Wireshark and install this packet analyzer? To know some details of this tool, refer to this post from php.cn that focuses on Wireshark and Wireshark download for Windows, macOS, and Linux.

How to Download and Install ChatGPT on Android? How to Run It? - MiniToolHow to Download and Install ChatGPT on Android? How to Run It? - MiniToolMay 04, 2025 am 12:48 AM

Do you want to download ChatGPT Android to use it on your mobile phone or tablet? Where to download ChatGPT APK? In this post, we will introduce a safe and reliable source for downloading and installing ChatGPT Android.

Guide: Transfer Bookmarks from One Google Account to AnotherGuide: Transfer Bookmarks from One Google Account to AnotherMay 04, 2025 am 12:47 AM

If you want to transfer bookmarks from one Google account to another, you need to first export your Chrome bookmarks and then import them to another Google account. It is very easy to do this. php.cn Software will show you a complete guide in this po

How to Manage Updates in Windows 11/10? - MiniToolHow to Manage Updates in Windows 11/10? - MiniToolMay 04, 2025 am 12:46 AM

Do you know how to manage updates like pausing the updates for a period or scheduling a restart to finish the installation in Windows 11 or Windows 10? In this post, php.cn Software will show the answers you want to know.

Word Proofing Tools Is Missing: Key Causes & Repair MethodsWord Proofing Tools Is Missing: Key Causes & Repair MethodsMay 04, 2025 am 12:45 AM

Word proofing tools makes your sentences more professional without grammatical errors. However, sometimes you may encounter missing proofing tools in Word. If you are bothered by this issue, do not worry. This article on php.cn shows you some feasibl

How to Download/Install/Use Dell Optimizer on Windows 11/10 - MiniToolHow to Download/Install/Use Dell Optimizer on Windows 11/10 - MiniToolMay 04, 2025 am 12:44 AM

Want to download Dell Optimizer? This post from php.cn tells you how to download and install Dell Optimizer on Windows 11/10. Besides, you can know what it is and how to use it. Now, keep on your reading.

Top 4 Proven Fixes for AutoSave Not Working in Microsoft OfficeTop 4 Proven Fixes for AutoSave Not Working in Microsoft OfficeMay 04, 2025 am 12:43 AM

Do you encounter Microsoft Word, Excel, or PowerPoint stopping autosaving your files on Windows 10/11? Don’t panic! Every problem has a fix. In this post on php.cn Website, you will find some effective solutions.

See all articles

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

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.