TestDisk and PhotoRec repair and recover
Oh no, you hit the delete button and now you want your file back! What do you do? The first thing you do is stop and don't do anything. When you delete a file it's still there on your hard disk, with the space it uses marked as available for new files to be written on, so as long as it's not overwritten you can recover it. (If you ran DBAN, sorry, it's gone for good.) PhotoRec (for "recovery", not "wreck") recovers individual files of any kind and not just photos. TestDisk is a marvelous companion program for repairing damaged partition and boot tables. Both work on all major operating systems and filesystems, and have excellent documentation that tells you exactly what to do.
Source: Carla Schroder
You can install these on just about any operating system (Mac, Linux, Windows, the BSDs and other Unixes), but the best way to run them is from bootable media. TestDisk and PhotoRec are included on a large number of Linux-based system rescue distributions like GParted LiveCD and Knoppix. My favorite is System Rescue on a USB stick, because it is fast even on older, less-powerful computers. My preferred method is to copy any restored files to a USB stick, USB hard drive, or to a different partition on the original drive, in order to disturb the bits I'm trying to recover as little as possible. (Replaces Recover Lost Partition, Active@ Partition Recovery, Disk Doctors.)