0

I was unable to empty my trash so I used the below command:

sudo rm -rf ~/.local/share/Trash/*

and it deleted everything from all the directories, home and downloads

Can any one please help?

Ravexina
  • 55,668
  • 25
  • 164
  • 183
  • 3
    You may have accidentally run sudo rm -rf ~/ .local/share/Trash/. Note the space between ~/ and .local. That would delete your home directory. – wjandrea Jun 17 '17 at 00:02
  • Another cautionary example on why sudo should be used with great care, especially when issuing destructive commands such as rm. – jones0610 Jun 17 '17 at 00:09

3 Answers3

3

The command sudo rm -rf ~/.local/share/Trash/* will only remove the contents of your local Trash directory. Additionally, for future reference, deleting your own user trash does not require sudo privileges.

Your $HOME files structure may indeed be deleted as you say, but the command you posted wouldn't do that.

jones0610
  • 2,157
2

first don't run the system to avoid overwriting data. boot from a live CD extundelete is a good program for recovering files by reading inodes.

ravery
  • 6,874
1

Run a liveCD / USB and mount the partition containing your lost files as readonly. ex. If your /home partition is on sda2, execute these commands:

mkdir ~/recovery/

sudo mount -o ro /dev/sda2 ~/recovery/

Recover your user directory and all it's contents:

sudo extundelete /dev/sda2 --restore-directory /home/username/
jones0610
  • 2,157
  • You need to expand on your answer. What is extundelete? How do you install/run it? You can't modify/fix a directory that's mounted ro. Also, best not to answer the same question more than once... better to edit your first answer with additional details. – heynnema Jun 17 '17 at 14:33