When you delete a file from your computer, it doesn't actually get deleted. In most operating systems you have a trash can, or something like that, the file goes here first. After you delete it from the trash can, it is still recoverable, due to the nature how hard disk storages work.
The first part of the deletion is usually putting the file into a segregated space like a trash can, or on Linux sometimes it makes it hidden, but it still remains there. Nontheless even if you find the file afterwards and delete it, it still remains on the disk.
Hard disks work like a net of data, every single bit is next to eachother, and what we call "files" or "partitions" are just a logical unit of data, whereas you have a pointer that selects the address of the file and points to it as being an integral file. When a deletion happens, the pointer gets erased, but the data still physically remains on the disk.
The pointer tells to the computer that that zone is used, to not accidentally overwrite the file, but after the pointer is removed, the file could still remain there, until it's overwritten. And that could take a lot of time until every single bit of free space on your hard drive gets overwritten.
If you have accidentally deleted some files, and you want to recover them, it is very easy, given that they haven't been overwritten completely. If they were a little bit then it's still recoverable with some damages to a file, like for example if you deleted a family photo 1 month ago, and you want to recover it, it may still be recoverable, but there is a good chance that it might be pixelated, or some parts of the photo unreadable.
For example if the photo you accidentally deleted 1 month ago was this:
It could be damaged by the time you recover it:
So it is important to recover it as fast as possible, usually files recovered within 1 hour should still be intact, but there are no guarantees. Obviously you should carefully delete files that you might want to recover later.
The disk constantly gets read/write signals, so the free space gets overwritten eventually, that is why time is the key.
HOW TO RECOVER
On Linux:
- Install PhotoRec, it's very easy to recover files with it:
sudo apt-get install testdisk
sudo photorec
It will install both packages, and then start photorec, and follow the instructions here:
http://www.cgsecurity.org/wiki/PhotoRec_Step_By_StepHere are the lists of files that it can recover:
http://www.cgsecurity.org/wiki/File_Formats_Recovered_By_PhotoRec
On Windows/Mac:
Download it from here (it's free): http://www.cgsecurity.org/wiki/TestDisk_Download
And just follow the instructions:
http://www.cgsecurity.org/wiki/PhotoRec_Step_By_Step
It's a command line utility but it's very easy to use, you can recover all forms of partitions with it (NTFS,FAT, EXT3,EXT4,...) , and supports more than 480 file formats. Good luck, it should be easy to use, but time is the essence, the faster you recover it, the higher the chances that the recovery will be successful.