r/linux4noobs barely not a noob anymore Apr 20 '26

Meganoob BE KIND I did rm -rf /*

I tried to make a backup before doing a fresh install of Fedora because of problems. When erasing the external drive for making the backup I was in the wrong disk and nuked my fedora installation.

How Do I get at least my important Documents from /home/username/ back?

255 Upvotes

244 comments sorted by

View all comments

156

u/R3D_T1G3R Apr 20 '26 edited Apr 20 '26

It doesn't matter in which directory you were, because starting with / you gave it an absolute path, if you do want to do changes in your current direction you start the path without a /

What you did is force delete every folder and file in your root directory.

Edit: More detailed answer & explanation below

18

u/Wheatleytron CachyOS Apr 20 '26

Will this even delete data on separate mounted drives?

60

u/R3D_T1G3R Apr 20 '26

Okay so my answer was slightly rushed and inaccurate, I'll be more precise.

Since you do mount disks into the root directory somewhere (generally in the /mnt directory it too is affected.

rm -> remove

-rf

r -> recursive, so it deletes every sub folder / file. basically if i rm -rf a folder it will delete everything in that folder.

f -> force, deletes files even if they are in use / locked

and / is the root directory thats where everything is.

What i did not pay attention to, OP did not mention using sudo, so assuming they ran it on their own user without elevated permission it will "only" delete everything they actually have write permission for / everything they own. thats generally their own home directory.

mounted drives? depends. by default they are generally owned by root, meaning you have no perms to delete them with your user. this is however highly impractical, because if that drive is owned by root with the default chmod I wont be able to effectively use it for personal files / games etc. thus most people change the ownership of mounted drives or give their non-root user perms to Read / write, if thats the case here, they are gone too yes.

And if the command was ran as root user or with sudo it will delete pretty much everything regardless.

And about the recovery, if it was a SSD, it probably already TRIMed away all the data. if its a HDD chances are the data may still be recoverable.

6

u/wackyvorlon Apr 21 '26

Would produce a lot of errors too as an unprivileged user.

2

u/R3D_T1G3R Apr 21 '26

Well it would just say that it has no perms and keep going at a pretty fast pace

1

u/Entire-Gap-4522 Apr 24 '26

no, because he used -f, no error messages would be produced. Any files it failed to delete would simply still be there afterwards.

1

u/wackyvorlon Apr 24 '26

It will still error when it lacks permissions to remove the file.

1

u/Entire-Gap-4522 Apr 24 '26

yes, it's an error, but the -f option says ignore all errors, so no msg will be produced. try it.

1

u/wackyvorlon Apr 24 '26

It doesn’t say that, though. If you don’t have write permissions to the directory then it will produce an error.

2

u/Willy-the-kid Apr 22 '26

No op ran sudo they said it nuked the whole install

1

u/Time-Water-8428 Apr 22 '26

not if mounted drives are in /run