I am using Ubuntu-Mate 20.04 and I have lost most of the contents of my home folder. I think it could be due to using wrongly the “rm” command with sudo, but not sure if it might be something else.
I explain: I was trying to delete a folder ( “targetfolder (something)” ) and its contents at /home/user2 while being logged as user1 (user1 has sudo privileges). So, I did:
sudo rm -r /home/user2/targetfolder (something)/
At first rm gave some error messages due to the parentheses - I mean this: ( ) -, so I substituted part of the folder’s name with *, and did:
sudo rm -r /home/user2/targetfolder */
NOTE: I perhaps used quotes for the name of the folder because of the blank spaces ( 'targetfolder *' ), though last command registered in terminal goes without quotes.
As I understand it, rm should only have deleted any folder with a name starting with “targetfolder” within the home folder of user2, but it seems to have deleted the major part of the home folder of user1. I add that as I was not clear if rm was working or not I closed the terminal killing, I guess, the process.
Just in case it is relevant, both user1 and user2 home folders are encrypted using ecryptfs (the folder to be deleted at /home/user2 was outside .Private and, therefore, unencrypted).
So, my question is if the rm command as I used it could have deleted the contents of the home folder of user1 (or even affected the system).
I have a recent backup of the lost contents, but I wanted to make sure it is not due to some problem other than the rm command.
Thanks in advance and sorry for my English.