How to recover deleted files in Ubuntu

How to recover deleted files in ubuntu

Great! here I will help you know how to recover deleted files in Ubuntu – linux.

A few days back, while moving my photos from android phone to an external hard drive, my system messed up and to my disappointment, I was no longer able to find a folder having photos from a recent solo trip to Rishikesh, Uttrakhand – India (blog coming soon). And we all know how important those pictures are for all of us.

What leads to data loss ?

There can be multiple reasons leading to data loss – accidentally deleted files, formatted disk, system crash, etc. No matter what’s the reason, it would be quite frustrating to lose them because of the machine’s hiccup.

Hold on, don’t lose hope yet – I’m here to save your day. By the end of the blog, you will have your cherished moments’ pictures back, safe with you.

Tool used – Testdisk

To recover deleted files in Ubuntu we will use the free command-line tool named Testdisk.

Install Testdisk

sudo apt-get install testdisk

Step-by-Step Guide to recover deleted files in Ubuntu (linux)

  1. Start testdisk sudo testdisk
  2. Use arrow keys to select [ No Log ], then press Enter key
    Select no log
    Select no log
  3. Then select a media
    Select media
    Select media
  4. Then select partition table type – take clue from suggestion at the bottom of the terminal
    Select partition table type
    Select partition table type
  5. Then select analyse
    Select analyse
    Select analyse
  6. Then select quick search 🔍
    Select quick search
    Select quick search
  7. Then select partition
    Select partition
    Select partition
  8. Then select deeper search
    Select deep search
    Select deeper search
  9. Now you will see, test-disk will begin its analysis – it will take its time based on disk size. Wait till it completes.
    Testdisk analysis in progress
    Testdisk analysis in progress
  10. Once analysis completes, “Press P” to list files on the disk
    Press p to list files
    Press p to list files
  11. Navigate to deleted files
    Navigate to deleted files
    Navigate to deleted files
  12. Use following keyboard keys to perform select, copy operations
    1. “:” – to select the current file
    2. “a” – to select all files in the current folder
    3. “c” – to copy the current file
    4. “C” – to copy the selected files
      Select copy deleted files
      Select, copy deleted files
  13. Navigate to target directory and press “C” to copy selected deleted files to selected destination folder
    Copy to destination folder
    Copy selected deleted files to destination folder
  14. Once all the files are copied, press “q” and onwards quit/exit on screen instruction.
    Exit testdisk
    Post copy, exit the testdisk command line

Congratulations! you just recovered your important deleted files successfully. Relax now and sip your favourite drink 🥂 (cheers).

Reference Link: https://askubuntu.com/questions/443376/recovering-very-important-lost-data-from-external-hard-drive-when-copying-it

You might also wanna read – How to use external hard drive with Mac

If you find this article helpful, don’t forget to leave your feedback, any query or simply Hi 🙋🏽‍♂️ in comments. Share this with your friends as this might save their day!

You can reach out to me on Instagram, Twitter, Facebook – find links below.

You may also like