Get the App
SLTechnology News&Howtos  ›  Servers  › 

Three methods of setting Environment variable by linux

Shulou Source: shulou.com Published: 2022-06-03 06:19:28 09月30日 Update

How to set the environment variable of linux? This problem may be often seen in our daily work. Through this question, I hope you can gain more. Let's take a look at the solution with the editor today.

1. Temporary

Export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:new_path_name

Where new_path_name is the new path. This is only valid for the current shell. Restart and disappear.

2. Permanent

Vim / etc/profileexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:new_path_namesource / etc/profile

The global environment variable, the restart does not disappear, is valid for all users.

3. Permanent

~ / .bashrcexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:new_path_namesource .bashrc

The global environment variable, the restart does not disappear, but is only valid for the currently logged in user.

This is the end of the three methods of setting environment variables in linux. Solving the problem is not just the method analyzed in the article and everyone, but the accuracy of the analysis method in this article is indisputable. If you like this article, you might as well share it for more people to see.

Tags: Variables environment effectiveness problems methods global articles more users permanent analysis no doubt accuracy methods solutions daily work solutions paths work login Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Linux MariaDB Apple Shulou Information