So I just recently downloaded Linux Ubuntu and I was experimenting with some of the functions to get used to Linux. While I was trying to learn I wrote in the terminal find . -delete -name (file name) thinking it would delete just that specific file BUT it deleted ALL my personal files in just about EVERY directory from home (I used this command in the home directory so kind of makes sense). I used a very specific file name though so I can't imagine that any other file would have the same name as it (it was "asdfasdf"). Is there anything I can do to restore all my information? And how should I have coded to just remove the specific file using find and NOT rm?

  • 2
    Does this answer your important question? How to recover deleted files? – user535733 Jan 7 at 21:11
  • Recovery of deleted files is not obvious, and even more difficult from a linux file system than from say the traditional FAT file system. Do not waste too much time and instead restore the files from a backup, which hopefully is not too much out of date. – vanadium Jan 7 at 21:37
  • For an explanation of why this happened, see for example find -delete Erased Everything – steeldriver Jan 7 at 21:58
  • Thanks for the response! That actually helped out a lot. I didn't quite read the full manual for find -delete and I assumed it would be fine. Thankfully there weren't any essential information as I just installed Ubuntu couple weeks back. I'll make sure I make back up copies and be careful while using terminal. Thanks for all the help. – Jiho Kim Jan 8 at 22:09

Short answer: no, because by default GNU/Linux doesn't come with a Recycle Bin when using terminal and executing commands like rm and find . -delete.

But as other users said, you could restore your files from a backup or try to restore them using some rescue software (but it'll take some time and as you execute more and more write operations on your disk, lower are the chances you're gonna get your data back).

Best regards.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.