Recovering deleted or lost files from your pen drive or hard disk files such as video, documents, and lost pictures from digital camera memory is a snap if you follow these steps.
Install the testdisk tool.
Run “sudo apt-get install testdisk” at the prompt.
This installs the testdisk tool.
Insert your pen drive.
Connect the pen drive that you want to recover files from.
This will work for any USB drive.
Run the photorec utility with sudo.
Type “sudo photorec” at the prompt.
You’ll need to enter your password when prompted.
Choose your pen drive and press Enter.
This selects the disk.
You’ll then be prompted to choose a filesystem.
Choose a filesystem and select “Search.”
After choosing the proper file system, choose Search at the bottom-left.
Choose the file system you were using.
You’ll need to choose whether the drive was formatted with Windows or Linux.
Select a location to scan.
You can choose Free or Whole to continue.
Choose to recover all files, not just those from unallocated space.
Choose a destination folder and press “C.”
Select a location to restore the files to.
Once selected, press the key on the keyboard. This begins the recovery process and shows the status of recovered files.