How to Recover Deleted Files in Ubuntu

Techwalla may earn compensation through affiliate links in this story.

It happens to everyone sometimes--no matter how much we try to avoid it. We all lose a file or two sometimes that we didn't back up and we absolutely need to get back. For Windows users there are plenty of third-party tools that you can purchase for recovering lost data. Ubuntu users are even luckier; they can get their lost files restored free of charge. Scalpel, a free software tool for data recovery, is both easy to use and available from inside your Ubuntu installation.


Step 1

Check your Trash folder to make sure that the files you're looking for are not there. If you deleted them by hand, it is likely that they are just sitting there waiting for you to take some sort of action. If they are there, restoring them is a matter of pushing a button. However, if you have lost your data some other way than further action will have to be take.


Video of the Day

Step 2

Open a terminal. Type "sudo apt -get scalpel" to download and install Scalpel, a program that recovers lost data and files on your Ubuntu system. After the download completes, the installation should begin automatically. For the sake of expedience, we are going to assume that you have accepted all the default values for the installation. Once the installation is complete, you are ready to use Scalpel and attempt to recover your lost data.


Step 3

Enter "scalpel/dev/sda1 -o output" in a terminal; "output" should be replaced with the name of whatever folder you want to recovered files to be put in. Also, "sda1" is the default name of the user drive on Ubuntu. However, if you have changed its name or a re trying to recover files from a different drive, then you will have to replace it with the name of that drive. Running the command will start Scalpel's search of your hard drive for lost data. Though it is hard to predict how long the search should take, the larger your hard drive the longer the search will last. After Scalpel has finished its search, simply open the designated folder and you can begin using your recovered files.


UbuntuOne, or any other backup service, is good way to avoid losing your files, as you will have copies “in the cloud.” As a general rule, all important files should be backed up.


As with any data recovery program, there is no guarantee that the files you are looking for will be restored, especially if they have been written over more than once.