Software & AppsOperating SystemLinux

Recovering Deleted Perl Files in Ubuntu Using Live USB

Ubuntu 10

In the digital world, data loss is a common issue that many users face. One might accidentally delete important files and need to recover them. This article will guide you on how to recover deleted Perl files in Ubuntu using a live USB. We will use two powerful tools, TestDisk and PhotoRec, to achieve this.

Quick Answer

Recovering deleted Perl files in Ubuntu using a live USB is possible using tools like TestDisk and PhotoRec. These powerful data recovery software can help you retrieve lost files and folders from your hard disk.


Before we start, you will need a live Ubuntu USB. If you don’t have one, you can create it using software like Rufus or Etcher. You can download the Ubuntu ISO from the official Ubuntu website.

Booting from the Live USB

First, insert the live USB into your computer and restart it. As your computer boots up, press the appropriate key to enter the boot menu. The key varies depending on your computer’s manufacturer. It could be F12, F10, F9, or another key. Once you’re in the boot menu, select your USB drive and press Enter to boot from it.

Installing TestDisk

Once you have booted into the live Ubuntu environment, the next step is to install TestDisk. TestDisk is a powerful open-source data recovery software. It is primarily designed to help recover lost partitions and/or make non-booting disks bootable again.

Open a terminal and run the following command to install TestDisk:

sudo apt-get install testdisk

In this command, sudo is used to run the command as the root user, apt-get is the package handling utility in Ubuntu, install is the command to install a new package, and testdisk is the name of the package we want to install.

Recovering Files Using TestDisk

To launch TestDisk, run the following command in the terminal:

sudo testdisk

TestDisk will display a list of available disks. Select your hard disk from this list. Use the arrow keys to navigate and Enter to select.

Next, choose the partition type. If your hard disk has Linux partitions, select [Intel].

TestDisk will then display the directory structure of your disk. Navigate to the deleted files or folders using the arrow keys. Press C to copy the selected files or folders to a destination of your choice.

Once you have recovered all the desired files, you can exit TestDisk.

Using PhotoRec for File Recovery

If TestDisk doesn’t recover the specific Perl files you need, you can try using PhotoRec. PhotoRec is a file data recovery software designed to recover lost files including video, documents, archives from hard disks, CD-ROMs, and lost pictures from digital camera memory.

To install PhotoRec, use the same command as for TestDisk:

sudo apt-get install testdisk

To launch PhotoRec, run the following command in the terminal:

sudo photorec

As with TestDisk, PhotoRec will display a list of available disks. Select your hard disk from this list.

Next, choose the partition type. If you are using Linux, select ext2/ext3/ext4. Otherwise, select Other for FAT or NTFS partitions.

Choose the space for analysis. If you haven’t written to the partition after deleting the files, select Free. If you have written to it, select Whole.

Finally, select a directory to store the recovered files and press Y to start the recovery process. PhotoRec will display the number of files it has recovered.


Data recovery is a delicate process. It is important to avoid writing any new data to the disk containing the deleted files to prevent overwriting them. Using a live USB minimizes the risk of data loss. TestDisk and PhotoRec are powerful tools that can help you recover your lost Perl files in Ubuntu. Always remember to backup your important data to avoid such situations in the future.

Can I recover deleted Perl files using TestDisk and PhotoRec on any operating system?

TestDisk and PhotoRec are primarily designed for Linux-based operating systems like Ubuntu. While they may work on other operating systems, their functionality and compatibility may vary.

Do I need to have a live USB to recover deleted Perl files in Ubuntu?

Yes, a live USB is required to boot into the Ubuntu environment and perform the data recovery process. This allows you to minimize the risk of further data loss and avoid overwriting the deleted files.

Can TestDisk and PhotoRec recover files from a formatted or corrupted hard disk?

Yes, TestDisk and PhotoRec can recover files from formatted or corrupted hard disks. TestDisk specializes in recovering lost partitions, while PhotoRec focuses on recovering specific file types. However, the success of the recovery process may depend on the extent of the damage to the disk.

Is it possible to recover Perl files that were deleted a long time ago?

The chances of recovering Perl files that were deleted a long time ago depend on various factors, such as the usage of the disk after deletion and the effectiveness of the recovery tools. If the disk has been heavily used or overwritten, the likelihood of successful recovery decreases. It is recommended to attempt recovery as soon as possible after deletion for higher chances of success.

Can I choose a specific directory to store the recovered Perl files?

Yes, both TestDisk and PhotoRec allow you to select a destination directory to store the recovered files. You can choose a location of your choice within the Ubuntu environment or on an external storage device connected to your computer.

Leave a Comment

Your email address will not be published. Required fields are marked *