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 restore mistakenly deleted tree commands

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

Share

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

How to restore mistakenly deleted tree commands

Examine the usage of rpm,yum

Delete the tree command. The tree command is not available

[root@centos7 ~] # which tree

/ usr/bin/tree

[root@centos7] # rm-f / usr/bin/tree

[root@centos7] # tree.

Bash: tree: command not found...

Direct yum or rpm installation will prompt tree that it has been installed

[root@centos7 ~] # yum install tree

Loaded plugins: fastestmirror, langpacks

Loading mirror speeds from cached hostfile

Base: mirror.bit.edu.cnextras: mirrors.tuna.tsinghua.edu.cnupdates: mirrors.tuna.tsinghua.edu.cn

Base | 3.6 kB 00:00:00

Extras | 3.4 kB 00:00:00

Nginx | 2.9 kB 00:00:00

Updates | 3.4 kB 00:00:00

Package tree-1.6.0-10.el7.x86_64 already installed and latest version

Nothing to do

[root@centos7] # rpm-ivh / misc/cd/Packages/tree-1.6.0-10.el7.x86_64.rpm

Preparing... # # [100%]

Package tree-1.6.0-10.el7.x86_64 is already installed

Solution: mandatory override installation

[root@centos7] # rpm-- help

-- replacepkgs reinstall if the package is already present

[root@centos7] # rpm-ivh / misc/cd/Packages/tree-1.6.0-10.el7.x86_64.rpm-- replacepkgs

Preparing... # # [100%]

Updating / installing...

1:tree-1.6.0-10.el7 # # [100%]

4. Tree can be used at this time.

[root@centos7] # tree. -d

.

├── Desktop

├── Documents

├── Downloads

├── Music

├── Pictures

├── Public

├── scripts

├── Templates

└── Videos

9 directories

5. Yum can be reinstalled

[root@centos7] # yum-- help

Reinstall reinstall a package

[root@centos7] # rm-f / usr/bin/tree

[root@centos7] # tree-d.

-bash: / usr/bin/tree: No such file or directory

[root@centos7 ~] # yum reinstall tree-y

[root@centos7] # tree-d.

.

├── Desktop

├── Documents

├── Downloads

├── Music

├── Pictures

├── Public

├── scripts

├── Templates

└── Videos

9 directories

Of course, you can also find tree's rpm package, use rpm2cpio and cpio-id to extract the package, and move the tree command back to its original location

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