How to Recover Deleted Files in Linux: A Step-by-Step Guide | recover deleted files | Linux file recovery tools | restore deleted files from trash | recover files from Linux recycle bin | TestDisk Linux | PhotoRec Linux | recover deleted partitions Linux | Extundelete tutorial | R-Linux file recovery | BleachBit for Linux recovery

 Accidentally deleting files is a common mistake, but don’t panic just yet—it's often possible to recover those files in Linux. Whether you’ve lost files from your regular file system or emptied the trash/recycle bin, several free software tools can help you restore them. This guide will walk you through the process, explaining each step clearly, and showing you how to use some of the best free Linux file recovery tools.

1. Check the Recycle Bin or Trash First

Before you dive into complex recovery processes, the first step is to check your system’s Recycle Bin (also called Trash on Linux). In many cases, deleted files are still there and can be easily restored.

How to Restore Files from Trash:

  • Open your file manager (e.g., Nautilus, Dolphin, Thunar).
  • Look for the “Trash” or “Recycle Bin” in the sidebar.
  • Browse through the files, right-click on the ones you want to recover, and click Restore.

2. Using TestDisk to Recover Deleted Files

TestDisk is a powerful, free, open-source tool that works on Linux and many other operating systems. It's designed to help recover lost partitions, but it can also restore deleted files from ext3/ext4 file systems, which are common in Linux.

How to Use TestDisk:

  1. Install TestDisk using your terminal:

    sudo apt install testdisk
  2. Launch TestDisk by typing sudo testdisk in the terminal.
  3. Follow the on-screen instructions to select the disk or partition where your files were deleted.
  4. Choose Analyse to check for lost partitions.
  5. Navigate through the options and look for Search to find deleted files.
  6. Once found, you can select files and use the Copy option to restore them to a safe location.

TestDisk is great for situations where you’ve lost an entire partition or need to recover files from a system crash.

3. Using PhotoRec to Recover Files from Deleted Partitions

PhotoRec, developed by the same creators of TestDisk, is specifically designed for file recovery from damaged or deleted partitions. It works well for recovering a variety of file types like documents, videos, images, and more.

How to Use PhotoRec:

  1. Install PhotoRec via the terminal:

    sudo apt install testdisk
  2. Launch PhotoRec using the command:

    sudo photorec
  3. Select the disk or partition you want to scan for deleted files.
  4. Choose the file types you want to recover (e.g., DOCX, JPG, MP4).
  5. Select the destination folder to save the recovered files.
  6. Let PhotoRec scan and restore your deleted files.

PhotoRec is excellent for restoring files even after they have been removed from the Trash or Recycle Bin.

4. Extundelete for ext3/ext4 File Systems

If you're using ext3 or ext4 file systems, Extundelete is a great tool to try for file recovery. It specifically targets these file systems, which are common in Linux.

How to Use Extundelete:

  1. Install Extundelete using:

    sudo apt install extundelete
  2. Unmount the partition you want to recover files from:
    bash

    sudo umount /dev/sdX1
    Replace /dev/sdX1 with the appropriate device name.
  3. Run Extundelete to recover files:
    bash

    sudo extundelete /dev/sdX1 --restore-all
  4. Check the RECOVERED_FILES folder created by Extundelete for your restored files.

5. Using R-Linux to Recover Files from Recycle Bin

If you've emptied the trash and need to recover files, R-Linux is another free tool that can help you out. It supports various Linux file systems, such as ext3/ext4, and can restore deleted files from both the Trash and the Recycle Bin.

How to Use R-Linux:

  1. Download and install R-Linux from its official website.
  2. Open R-Linux and select the disk where you lost files.
  3. Click on Search for Lost Files and wait for the scanning process to complete.
  4. Browse through the results to find the deleted files.
  5. Select the files you want to recover, and click Recover.

6. Using BleachBit for System Cleanup & File Recovery

Although BleachBit is primarily known as a system cleaning tool, it can help you recover some deleted files from Linux. While it doesn’t support extensive recovery like the other tools, it’s useful for quickly restoring small files that were accidentally deleted.

How to Use BleachBit:

  1. Install BleachBit:

    sudo apt install bleachbit
  2. Launch BleachBit and check for the "Shredder" option under the File menu.
  3. Select the directory where you deleted files and run the cleanup tool.
  4. It will give you an option to restore certain files, depending on the level of deletion.

Conclusion

File recovery on Linux doesn't need to be a daunting task. By following the steps outlined above, you can recover files from your Recycle Bin, damaged partitions, or even empty trash folders. Tools like TestDisk, PhotoRec, Extundelete, R-Linux, and BleachBit provide free, reliable solutions to restore deleted files.

If you find yourself in a situation where important files are gone, don’t panic. Instead, use the tools mentioned here to retrieve your data step by step. Remember to act quickly and avoid writing new data to the disk to maximize your chances of successful recovery.

Comments

Popular posts from this blog

Best Free macOS Apps to Control External Displays and Their Resolutions | Best free macOS app for external display | change resolution macOS | free display manager for Mac | control external display resolution | macOS external display management tools | adjust resolution macOS

How to Use ChatGPT API in Your Code: A Simple Step-by-Step Guide | ChatGPT API integration | use ChatGPT in code | OpenAI API tutorial | Python ChatGPT API | JavaScript ChatGPT API | how to use OpenAI API | ChatGPT API key setup | API response handling