1

I found a command online to clear the trash for you because I wanted to clear a file without doing it throught GUI. The command is sudo rm -rf ~/.local/share/Trash/* . I called it and saw the folder on my right monitor disapear. I looked on the left monitor to see everything gone. I looked up recovery tools for ubuntu and found photorec . I used it and it said it recovered 200 files but none are there. EVERYTHING from my home directory is gone as well as Documents downloads, etc. How can I recover this? I had many important things I didn't back up.

The User
  • 153
  • 2
    Is it possible you accidentally put a space between ~ and /, or between / and ., or between the last / and *? Whatever happened...it sounds like extundelete may help. See How to recover deleted files? – Eliah Kagan Apr 08 '15 at 23:23
  • 1
    I had many important things I didn't back up. Now you know better. – Alex Apr 08 '15 at 23:31
  • 1
    Also a side note, running user specific commands (I.E removing files from your home folder) really shouldn't be ran with sudo as it can be very dangerous. If you made mistake and included / in the rm command you'd remove your whole system instead of just your home folder. – Michael Lindman Apr 08 '15 at 23:33

1 Answers1

0
  1. Run sudo testdisk in terminal.
  2. Unless you want a log file of the operations, choose No Log and press Enter.
  3. Hard drives are shown, it is possible to distinguish them with the size and the model name. Go on the hard drive you want to analyse and press Enter.
  4. You are asked for what is the partition table, for a normal PC it should be Intel. EFI GPT is for recent Apple Macs, Mac is for old PPC Mac. Choose the right one and press Enter.
  5. Choose Analyse and press Enter.
  6. Testdisk shows the current partitions, press Enter again to do a Quick Search
  7. Choose the partition that contains the files you want to recover and press the letter P. If you can't identify what is the right partition, you can try one. At any time your can come back to this menu by pressing the letter Q
  8. You are now in the directory tree (files and folders) of the partition! Each line starting with d letter is a folder, each line starting with a hyphen (-) is a file. Red lines are files/folders that have been deleted. You can move in files and folders with arrow keys on the keyboard, you can open a folder by pressing Enter and you can go to the parent folder by going on the double dot (..) and pressing Enter. The location where you are is always shown at the top near the word Directory. You can recover a file or a folder at any time by pressing C.
  9. The first time you will press C, you will be asked where to copy the files. You have to move up to the destination folder and press C. For that purpose, you need to know the path of that folder. Once done, testdisk confirms you if the operation succeeded of failed, completely or partially. If you copy a large amount of files, be patient and wait for the transfer even if nothing happens on the screen.
  10. You're done!

Source: http://computriks.com/en/recover-file-testdisk

0x2b3bfa0
  • 8,780
  • 6
  • 36
  • 55