0

Is there a way to recover removed files in a situation such as described below? The command I executed was:

root@system:/# rm -r /tmp/letsencrypt.sh-XXXXXX l*

I tried to remove all the files in that directory that started with an l. When I noticed what I did it was too late, I know, pretty stupid...

I quickly made a snapshot after. Does anyone know some way to save my system? Or how I can search for files in it? It seems ls is also gone:

root@system:/# ls /tmp
bash: /bin/ls: No such file or directory

root@au-dev:/# echo *
bin boot dev etc home initrd.img media mnt opt proc root run sbin snap srv sys tmp usr var vmlinuz
oscrx
  • 1

1 Answers1

0

Is there a way to recover removed files in a situation such as described below?

Technically, yes for example using testdisk. However, it is not worth it. You basically deleted some system files (the entire /lib and /lib64 directories) but not your user data.

Therefore, you are better off just making a copy of your home directory and reinstalling from scratch. I have described how to back up files using a live CD in this answer, here's an excerpt:

Backup using a live DVD or USB

If you have access to a Ubuntu installation medium, do the following:

  • boot your computer using the live DVD or USB
  • connect the external hard drive
  • run sudo nautilus in the terminal
  • copy all the files you want in the external drive
  • safely disconnect the drive
  • re-install Ubuntu