You can’t always blame data loss on hardware failure. A clumsy user can be just as harmful. PhotoRec is a nifty little command-line based tool that can recover accidentally deleted files.
To use PhotoRec effectively you need to understand how the filesystem handles files. When you delete a file, it isn’t actually zapped into oblivion. Rather the file system just marks it as deleted, and makes the space the file occupies available to other files.
This means that until another app uses that recently freed-up space, the original file is still there, and can be retrieved by a file recovery tool. For this very reason, it’s very important that you immediately stop using the computer as soon as you realize that you have accidentally deleted files in order to minimize the interactions with the hard disk.
Note: PhotoRec is cross-platform compatible. For this tutorial, we will use a Linux (Ubuntu) system for illustration.
Full article here:
How to Recover Accidentally Deleted Files Without Paying Outrageous Fees (Make Tech Easier)