+5 votes
322 views
How to recover deleted files in Linux using commands

in Security by (552k points)
edited | 322 views

1 Answer

+5 votes

Recover deleted files on Linux
Linux how to recover deleted files

In this article we are going to see how we can easily recover deleted files in Linux .

Have you mistakenly deleted a file?

Don't worry, follow these steps and hopefully we can recover the file or files.

We will carry out the process using the Test Disk tool

It is a simple tool to use so you will not have any problem.

First of all, don't worry.

As long as you do not write to the drive the file that you have deleted will continue to exist so that we can recover it.

Depending on the file size and the free space on your disk drive, the deleted files may persist indefinitely.

Recover deleted files on Linux

Step 1

The first thing we have to do is install the TestDisk tool.

Most Linux distributions already have TestDisk in the official repository.

We open the Terminal / command console and write the following:

  1. sudo apt install testdisk

If you are an Arch Linux user, you can install TestDisk from AUR.

If you want to install manually, you can do it from this link .

Step 2

Run TestDisk in Terminal using the following command:

  1. testdisk

Step 3

When you open the program, you will see something like this.

Do not worry! The interface is very simple.

To navigate it is necessary to use the arrow keys and "enter" to select.

We give Enter in the first option: CREATE A NEW LOG FILE

Step 4

Now, at this point, you should already see your hard drive and very soon you will be able to recover your deleted files.

If you could not see your disk as in the image, perform step number 2 with the following command:

  1. sudo testdisk

Now you should not have any problem and you are ready to continue

Step 5

We will select the drive in which we want to recover the files and we will give Enter

Step 6

There is little left!

TestDisk automatically selects the correct setting so you don't have to worry about a thing.

Now we will give an Enter

Step 7

Cheer up! You are about to finish, there are only 3 more steps left.

We will give an Enter in the Advanced option of the program

Step 8

At the bottom of the program we will see an option that says "Undelete" we will give an Enter

Step 9

Testdisk will start looking for the files on the disk and will create a file list.

Deleted files appear in Red

Step 10

Now choose the file or files you want to recover with the arrow keys (up and down) and press the  key to recover the file.

After pressing the C key , TestDisk will ask us where we want to save the recovered file, by default it is saved in the startup folder.

Brilliant! We have already recovered our file deleted by mistake.

Linux how to recover deleted files

Have you already learned how to recover deleted files? !! The process has been simple, right?

Have you managed to recover your files? Leave a comment and if you have any problem I will help you solve it.


by (552k points)

Related questions

+5 votes
1 answer
asked Oct 27, 2019 in Security by backtothefuture (552k points) | 1.2k views
+4 votes
1 answer
+5 votes
1 answer
asked May 25, 2019 in Windows 10 by backtothefuture (552k points) | 302 views
+4 votes
1 answer
+3 votes
1 answer
asked Oct 25, 2023 in Guides by backtothefuture (552k points) | 59 views
Sponsored articles cost $40 per post. You can contact us via Feedback

Most popular questions within the last 30 days

10,659 questions
10,791 answers
510 comments
3 users