Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How linux modifies path environment variables

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

Editor to share with you how linux modifies path environment variables, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Linux modifies path environment variables: 1. Modify temporary PATH;2 by "export PATH=/usr/local/mongodb/bin:$PATH", modify current user PATH by ".bashrc file: vim ~ / .bashrc", etc.

This article operating environment: linux5.9.8 system, Dell G3 computer.

How does linux modify the path environment variable?

Linux can modify PATH environment variables in four ways:

There are four ways for Linux to modify PATH environment variables, each with different permissions. Add the mongodb server variable as the column:

1. Modify temporary PATH

Check out PATH:echo $PATH

Modification method 1: export PATH=/usr/local/mongodb/bin:$PATH

/ / after configuration, you can view the configuration results through echo $PATH.

Effective method: effective immediately

Validity period: temporary changes can only be valid in the current terminal window. The original path configuration will be restored when the current window is closed.

User limitations: for current users only

two。 Modify the PATH of the current user

By modifying the .bashrc file: vim ~ / .bashrc

/ / add: export PATH=/usr/local/mongodb/bin:$PATH on the last line

Effective method: (there are two kinds)

1. Close the current terminal window and reopen a new terminal window to take effect

2. Enter the "source ~ / .bashrc" command to take effect immediately.

Term of validity: permanent

User limitations: for current users only

3. Modify the PATH of all users

By modifying the profile file: vim / etc/profile/export PATH

/ / find the line that sets the PATH, and add:

Export PATH=/usr/local/mongodb/bin:$PATH

Effective method: system restart

Term of validity: permanent

User limitations: for all users

4. Modify the PATH of the system environment

By modifying the environment file: vim / etc/environment

Add ": / usr/local/mongodb/bin" to PATH= "/ usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"

Effective method: system restart

Term of validity: permanent

User limitations: for all users

These are all the contents of the article "how linux modifies path environment variables". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report