Hi. So I was an idiot and ran the command sudo find . -maxdepth 1 -type d -exec rm -r {} \;
in my / folder. I thought I was in another folder and I was getting rid of some files that had root permission on them, files that I made but made wrong. After I realized where I just executed the command I stopped it, freaked out, and calmed down as I realized my important files were on my NAS or on another drive. Now I need to get my PC back to a workable state. How would I do this? Is there a way I can repair it link how Windows has it or is it just going to be a total reinstall? Any and all help would be great as I donāt really know where to go from here.
It depends.
What state is the system in? Does it work mostly? Can you log in and execute commands?
Do you have timeshift/btrfs backups?
Iām pretty sure all official versions come with that by default since a little while.
I am not sure. I donāt think I set anything like that up. How can I check?
I am still logged in and can execute commands and can still generally move around but most of the customization I did is gone. Iāve made my peace with that but I am not sure about stuff I donāt know about. I ran that command in the / directory so it could have done a LOT more damage than I know.
This from when it happened if it helps at all.
BTRFS stuff is all contained at this wiki page, with this link pointing to the rollback instructions:
ā¦but given the example of what you actually didā¦
It appears you didnt affect the root fileystem at all.
You did start to thrash your $HOME though while using sudo.
( .
is equal to āhereā, and your current working directory was $HOME [/home/username/
] )
So really you just need to get back your $HOME files and permissions.
Possibly the easiest might just be create a new user and then place important stuff there, remove old user.
I opened timeshift up and it didnāt have any snapshots for me, Iāll be sure to set that up when this is all fixed though. Without a backup there wouldnāt be any way to recover them, correct? No magic undo?
Could you point me in the direction of how to make a new user and then remove the old one?
You can try methods like photorec
or some other form of data recovery.
You can likely just use your Desktop Environmentās āSystem Settingsā or similar to add/remove users.
Or see here: Users and groups - ArchWiki
Here are also some valuable tips if you still intend to recover some of the deleted files:
By default timeshift
does protect only ā/ā, but not ā/homeā
So you need to set it up, so that it also protects(snapshots) /home
There also is snapper
I prefer snapper
because snapper adheres more closely to the btrfs developersā specifications than timeshift
.
However, timeshift is easier to set up and use.
As far as i know there is no kind of āphotorecā for btrfs yet.
But there are programs to additionally save snapshots of btrfs externally.