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

Overwrite the solution of command invalidation prompt command not found caused by previous PATH

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

Share

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

A colleague asked me to help him locate, why his LINUX server many commands can not be used, prompt (command not found), and more deadly is a lot of system services, scripts can not run. Asked, what have you done before? He said what to do, but he added export PATH to the / etc/profile file and asked, how did you set it up? The answer is:

[root@localhost ~] # vim / etc/profile export PATH=/usr/lib/jenkins/ [root@localhost ~] # source / etc/profile

He said he simply added the default working directory for jenkins and then used source to make the configuration file take effect. In fact, that's exactly what the problem is!

PATH is the path of the system environment, and all commands and scripts of the system are searched according to the path of PATH. But if export PATH=/usr/lib/jenkins/, overwrites all the directories previously set by the system, such as (/ bin/; / sbin and other directories where system commands are stored) and becomes jenkins working commands, while ls, pwd, cd and other system commands can certainly not be found in the jenkins directory, as a result, all commands, scripts, and services will not run away, which is the main reason for this murder!

How to set up the real system PATH?

If it is a short-term setting:

Export PATH=$PATH:/usr/lib/jenkins/

If it is a long-term setting:

[root@localhost ~] # vim / etc/profile export PATH=$PATH:/usr/lib/jenkins/ [root@localhost ~] # source / etc/profile

In this way, a new search path is added to the original settings without overwriting the original PATH.

Summary

The above is the whole content of this article. I hope the content of this article has a certain reference and learning value for everyone's study or work. Thank you for your support. If you want to know more about it, please see the relevant links below.

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