Ubuntu: Recover deleted files

Ever accidentally delete some files off a USB camera? Well, I did...and needed to get them back. No, these didn't go into the trash, because I deleted them from the terminal via the old "rm -rf ./folder" method. After a quick Google search, I found: http://www.cgsecurity.org

Here is basically what I did.

To be on the safe side, first I "dd"ed the Camera/card to a file:

dd if=/dev/sdb1 of=Images/USBCamera/pictures.img


Next, I installed testdisk:

sudo apt-get install testdisk


Finally, I launched the following utility, pointing it at my dd image:

photorec Images/USBCamera/pictures.img


The interface was pretty straight forward, and it did exactly what was expected. Once it was all done, all the previously deleted pictures were found in a "recup_dir" directory from the current location I was at.

Nice, simple....effective. Gotta love Open Source :exmark: