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 to add environment variables to CentOS

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to add environment variables to CentOS". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to add environment variables to CentOS.

After installing MATLAB on a Linux CentOS system, you need to add the matlab command to the system command for ease of use. If you execute the "matlab" command before adding it to the environment variable, you will be prompted for an error that does not exist in the command, as shown below:

Let me explain in detail how to add MATLAB to the environment variable under linux (MATLAB is installed in the / usr/local/MATLAB/R2013a/bin directory).

Method 1 (effective temporarily)

Running the command export PATH=$PATH:/usr/local/MATLAB/R2013a/bin directly, using this method, will only take effect for the current reply, that is, every time you log out or log out of the system, the PATH setting will become invalid, only temporarily.

Method 2 (effective only for currently logged-in users, permanent)

Execute vim ~ / .bash_profile to modify the PATH line in the file, add / usr/local/MATLAB/R2013a/bin to the PATH=$PATH:$HOME/bin line (separated by colons), save the file and exit, execute source ~ / .bash_profile to make it effective, this method only works for the current login users.

If you see the following figure, you can see that the environment variable has been added successfully:

Method 3 (effective for all system users, permanent)

Modify the / etc/profile file by adding the following two lines of code at the end of the file

PATH=$PATH:/usr/local/MATLAB/R2013a/binexport PATH

Finally, execute the command source / etc/profile or the point command. / profile to make the changes take effect.

At this point, I believe you have a deeper understanding of "how to add environment variables to CentOS". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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