How To Recover Deleted Files In Linux Using Rm Rf

How To Recover Deleted Files In Linux Using Rm Rf – While we believe this content will benefit our community, we have not yet explored it in depth. If you have suggestions for improvement, please let us know by clicking the “report a problem” button at the bottom of the tutorial.

Have you ever been in a situation where you accidentally deleted a file? In this tutorial, we will discuss how to install TestDisk on Linux and recover deleted files.

How To Recover Deleted Files In Linux Using Rm Rf

How To Recover Deleted Files In Linux Using Rm Rf

In this tutorial, I’ll be using Ubuntu Server, but even if you’re on a different distribution, you can follow the same steps. The only thing that will be different is the package manager used during installation.

Top 7 Best Data Recovery Software For Windows

The testdisk package is available on all major Linux distributions and can be easily downloaded using the default package manager. Here I have listed the distro specific commands to install testdisk on Linux.

How To Recover Deleted Files In Linux Using Rm Rf

We use apt package manager instead of apt-get because it is the new package manager for Ubuntu / Debian.

You also need to enable/install the EPEL repository. The EPEL repository is an optional package repository that provides easy access to package installations for common software.

How To Recover Deleted Files In Linux Using Rm Rf

Restoration “step By Step”

Now that you’ve installed the testdisk utility, it’s time to use it to recover deleted files or partitions.

You may not need to check if the partition is prepared, as the list above covers almost all the major partition types. But if you are not sure, enter one of the commands:

How To Recover Deleted Files In Linux Using Rm Rf

To launch the tool and you will be greeted with the instructions below. You can select the appropriate drive on which you want to recover files.

Using Local History To Restore Code Fragments Or Deleted Files

If you are running this tool for the first time, it will prompt you to create a log file on the pop-up screen. You can choose to create and just continue with the default settings.

How To Recover Deleted Files In Linux Using Rm Rf

It should automatically select the correct partition type, but if it doesn’t, make sure you’ve selected the correct partition type.

Once done, you will get a menu of options that we need to proceed with “Diagnosis” to search for lost data.

How To Recover Deleted Files In Linux Using Rm Rf

Deleted Files Recovery On Linux

You can switch to “Quick Search” or “Deep Search” as it suits your needs and let the search run until it has scanned all inodes.

Select the correct partition and let the tool scan the entire drive. After some time you will get a list of files inside the partition. When the scan is in progress, you will see a screen similar to the one below.

How To Recover Deleted Files In Linux Using Rm Rf

Now that the progress is complete, it will give you the option to select the section you want to browse files through. All files highlighted in “red” or any other color or text style (may also affect terminal configuration) are files that were recovered by the TestDisk utility.

How To Recover Deleted Dropbox Files More Than 30/180 Days?

To restore these files, simply press the letter “C” and it will allow you to copy that file and place it in another folder where you want to restore it.

How To Recover Deleted Files In Linux Using Rm Rf

Well there you have it. You have learned how to recover deleted files on Linux. Go ahead and explore this tool more on a virtual machine to understand it before using it in the real world so you know exactly how to work with it on an advanced scale.

We hope you have understood the use of testdisk utility in Linux and know how to use it now. If you have any questions, let us know in the comments below.

How To Recover Deleted Files In Linux Using Rm Rf

How To Send Files To Trash From The Linux Command Line

If you’ve enjoyed this tutorial and our wider community, please check out our products that can also help you achieve your development goals. While we believe this content will benefit our community, we have not yet explored it in depth. If you have suggestions for improvement, please let us know by clicking the “report a problem” button at the bottom of the tutorial.

Accidentally deleted files or photos. In this tutorial, we will learn how to recover deleted files on Linux with PhotoRec. In the previous tutorial, we discussed the steps to recover deleted files using a Linux utility called TestDisk, and the PhotoRec utility is made by the same company. Let’s find out how to use PhotoRec to recover deleted files.

How To Recover Deleted Files In Linux Using Rm Rf

TestDisk was created by CGSecurity to recover deleted partitions. PhotoRec, on the other hand, is designed to recover deleted files from SD cards and other removable media. Hence the name PhotoRec, which is short for Photo Recovery. That doesn’t mean you can’t use PhotoRec for other file types, you certainly can.

Solved How To Find Deleted Files On An Image On Linux? Using

Before we begin, we need to install PhotoRec on our Linux system. It is provided with the test disk utility and not as a separate package.

How To Recover Deleted Files In Linux Using Rm Rf

For this demonstration, I created a random image file and deleted it. Let’s go ahead and restore this file.

Let’s run PhotoRec in our terminal. To make things easier, navigate to the folder you want to run the recovery on before running the command.

How To Recover Deleted Files In Linux Using Rm Rf

Recover Permanently Deleted Files Easily In Kali Linux

After launching PhotoRec, select the hard drive you want to perform the recovery operation on and press the Enter key.

The next screen will ask you to select the partition on which you want to run the recovery process.

How To Recover Deleted Files In Linux Using Rm Rf

Before proceeding, make sure you select a file type from the file options menu you access on the partition selection screen.

How To Recover Data From A Wiped/erased Hard Drive In 2023

Since we know we’re only looking for our JPG file, I’ve chosen that extension. Everything else is unnecessary and will only waste more time. Select the file type you are looking for and continue.

How To Recover Deleted Files In Linux Using Rm Rf

This is where the command starts looking by default, unless you navigate to a specific folder on the next screen.

When you finish the folder where you want to start browsing, press the letter C and the program will start searching for files.

How To Recover Deleted Files In Linux Using Rm Rf

How To Recover Deleted Files On Linux Using Testdisk

Great So we’re all set to let PhotoRec recover deleted files for us. This may take some time depending on how many file types you have selected.

The folder named Recup_dir will start to recover all recovered files. You can access the files even while the recovery is in progress.

How To Recover Deleted Files In Linux Using Rm Rf

Great, we now have a list of all the files we previously deleted. You can search for the file you want here, as file names are not recovered by PhotoRec.

Recover Deleted Files

Have you ever noticed how saving a file to your hard drive takes time, but deleting it is almost instantaneous? Let’s understand that first.

How To Recover Deleted Files In Linux Using Rm Rf

When you store data on your hard drive, the data is stored in blocks. Each block contains a piece of data. The first block usually contains the metadata for the given file. Each block of data is written one at a time at the speed of the hard disk.

But when we delete the file, only the first field containing the metadata is deleted. The operating system can no longer detect the file because its metadata is lost and considers the blocks free to write new data.

How To Recover Deleted Files In Linux Using Rm Rf

How To Recover Deleted Files In Ubuntu Through Testdisk

This is where recovery tools come in. Since only the metadata is lost, it is up to the tools to make the metadata available for the operating system to read.

They read hard disk sectors one by one, block by block, and find contiguous blocks. After finding all contiguous blocks, recovery programs rebuild the metadata.

How To Recover Deleted Files In Linux Using Rm Rf

Like other file recovery tools, PhotoRec scans the data sectors on the hard drive to find the size of the data. When it finds the size of the data and the hard disk and the data is intact (not corrupted or overwritten), PhotoRec begins the data recovery process by looking for adjacent data blocks and recreating records for them.

Data Recovery Of Deleted Files From The Fat Filesystem

Since the tool cannot search for a specific file, it will return all found files and store them in a folder. You can then sort the files and recover the ones you need.

How To Recover Deleted Files In Linux Using Rm Rf

At the end of the process, all files that were still on your hard drive will be available for you to restore.

I hope you were able to use PhotoRec to recover deleted files on your Linux system. There are many other tools you can also try if PhotoRec doesn’t work for you.

How To Recover Deleted Files In Linux Using Rm Rf

How To Recover Deleted Files On Linux

Here is a list of top 20 data recovery tools for Linux. I’m sure you’ll find one that best suits your needs.

If you’ve enjoyed this tutorial and our wider community, please check out our products that can also help you achieve your development goals. One question Linux users probably have is whether there are programs like Recover My File on Windows for Kali Linux. Is it possible to recover deleted files in Kali Linux if we don’t have any backup? Fortunately, in Linux data recovery, just like Windows, there are many free and powerful tools that we can use to recover deleted files on Kali Linux.

How To Recover Deleted Files In Linux Using Rm Rf

Basically, no information about your system will be deleted by itself unless you delete it yourself. This deletion may be due to your ignorance. Because a very simple command in the command line (rm) can easily delete your data and the only thing we can do in this situation is to look at the black screen.

How To Recover Deleted Files

Similar Posts