US>Some files were deleted due to accidental rm-f/* execution

Asked 2 years ago, Updated 2 years ago, 57 views

I was going to run rm-f./*, but I turned it off as rm-f/*.

ls is

-bash:/bin/ls —No such file or directory

Also, yum is

-bash:/usr/bin/yum:/usr/bin/python:bad interpreter:No such file or directory

said he.Most commands are unavailable, and wget and so on will cause this error.

-bash:/usr/bin/wget:/lib64/Id-linux-x86-64.so.2:bad ELF interpreter:No such file or directory

The operating system is CentOS 7.

Please tell me what the solution is.

Supplemental
I will give up and reinstall.
However, if you know how to solve this problem, please reply for someone else who has made a mistake.

linux centos

2022-09-29 21:59

1 Answers

In the case of CentOS 7/64bit, four symbolic links /lib64, /lib, /bin, /sbin have been deleted, so you can recover by pasting them again.

#/usr/lib64/ld-linux-x86-64.so.2 -- library-path/usr/lib64/usr/bin/ln-s/usr/lib64/lib64
# /usr/bin/ln-s/usr/bin/bin
# ln-s/usr/lib/lib
# ln-s/usr/sbin/sbin

As a reference, there were other distributions already mentioned, so please refer to the link:

As you can see in the link, Ubuntu seems to have busybox installed as a standard, so you can recover using it.

The following are the results of running a similar command on CentOS 7/64bit in a virtual environment:

[root@localhost/]#ls-l
total32
lrwxrwxrwx.1 root root8 May 901:08 bin ->/usr/bin
dr-xr-xr-x.5 root root 4096 Apr 6 22:37 boot
drwxr-xr-x.20 root root 3160 May 901:03 dev
drwxr-xr-x.81 root root8192 May 901:02 etc.
drwxr-xr-x.3 root root root17 Aug 12 2015 home
lrwxrwxrwx.1 root root8 May 901:08 lib ->/usr/lib
lrwxrwxrwx.1 root 10 May 901:07 lib64 ->/usr/lib64
drwxr-xr-x.2 root root6 Aug 12 2015 media
drwxr-xr-x.3 root root 18 Feb 13 19:28 mnt
drwxr-xr-x.4 root root 51 Apr 6 22:44 opt
dr-xr-xr-x.165 root root 0 May 901:02 proc
dr-xr-x --- .3 root root 4096 May 901:03 root
drwxr-xr-x.24 root root 760 May 901:03 run
lrwxrwxrwx.1 root root9 May 901:08 sbin->/usr/sbin
drwxr-xr-x.2 root root6 Aug 12 2015 srv
dr-xr-xr-x.13 root root 0 May 901:02 sys
drwxrwxrwt.8 root root 4096 May 901:03 tmp
drwxr-xr-x.13 root root 4096 Feb 13 16:29 usr
drwxr-xr-x.20 root root 4096 May 901:02 var


[root@localhost/] #rm-fv/*
removed '/bin'
rm:cannot remove '/boot':Is a directory
rm:cannot remove '/dev':Is a directory
rm:cannot remove '/etc':Is a directory
rm:cannot remove '/home':Is a directory
removed '/lib'
removed '/lib64'
rm:cannot remove '/media':Is a directory
rm:cannot remove '/mnt':Is a directory
rm:cannot remove '/opt':Is a directory
rm:cannot remove '/proc':Is a directory
rm:cannot remove '/root':Is a directory
rm:cannot remove '/run':Is a directory
removed '/sbin'
rm:cannot remove '/srv':Is a directory
rm:cannot remove '/sys':Is a directory
rm:cannot remove '/tmp':Is a directory
rm:cannot remove '/usr':Is a directory
rm:cannot remove '/var':Is a directory


2022-09-29 21:59

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.