How to Recover a Deleted File on Linux Mint or Ubuntu
In this article, we will see how to recover a deleted file in Linux Mint.
We will cover two ways in details:
- R-Linux - free file recovery utility with GUI for Linux
- TestDisk - data recovery command-line tool
Step 1: Recover deleted files with GUI in Linux Mint
The first option to recover accidentally deleted files on Linux Mint or Ubuntu is by R-Linux.
It can recover deleted files from specific folders, trash and external drives.
Below are the steps to recover files with R-Linux:
- Install the utility
- Open the tool
- Enter root password on opening
- Select Drive - from the Device/Disk list (1-1)
- Open Drive Files (1-2)
- Wait until operation is completed
- Navigate to specific folder (where you would like to restore file) (2-1)
- Select files (2-2)
- Recover (2-3)
You can view the images in order to follow the steps:
Step 2: Recover deleted files command line Linux Mint
The second option is to use the command line to recover permanently deleted files in Linux Mint. The utility which we will use is called TestDisk.
It can be installed by:
sudo apt install testdisk
The steps to recover accidentally deleted files on Linux from command line are - you can use arrows + Enter to navigate in TestDisk:
- Run in terminal
testdisk
- Select log file option
- No Log - Don't record anything - I prefer this option
- Create - create a log file for the recovered files
- Enter root password (the previous step might repeat)
- Select a media
- disk, media or device from which you wish to recover the files
- Specify - partition table type
- The auto detected option is best in most cases
- Select operation - Advanced - Filesystem Utils is what we need to recover deleted files
- Select Partition
- From the bottom select List
- Navigate to the folder (where the deleted files are)
- the deleted files are in red
- Press C in order to copy the deleted files.
Now the deleted file is recovered!
Use Q to quit the program or go step back.
This tool will help us to recover recently deleted files in Ubuntu from:
- external hard drives
- specific folders
- Trash
- different partitions and devices
by using the Linux command line.