Accidental deletion of important files on your Linux computer can be disastrous. However, this data loss situation can be fixed. The Foremost Linux data recovery tool is one of the best software to recover lost/deleted files. In this guide, we will gladly discuss how to install Foremost on Linux and how it can be used to recover deleted files from USB and hard disks. Additionally, this article also provided the best alternative for Foremost file recovery.
In this article
Part 1. What Is Foremost?
Foremost is free software created by U.S. government agents and available to the public. Foremost tries to recreate the files directly rather than trying to retrieve them from your drive's file system.
The majority of operating systems only partially delete files from file systems. They eliminate the metadata, allowing the underlying data to be overwritten. Foremost will copy and examine the drive for this data, searching it bit by piece.
It will use the internal memory of your PC to temporarily store the data. Following that, it will look for specific file segments until it finds others that match them, then put them together like a jigsaw puzzle.
Here are some of the wonderful attributes that Foremost proudly offers:
- Attains the power to ignore the core filesystem.
- It has an extra configuration file to specify different file formats.
- It is easy to get files from the iPhone using a computer.
- It can also extract information from image files.
Supported Linux File System
- Ext2 (in older Linux distros) /ext3/ext4
Part 2. How To Use Foremost on Linux?
The following knowledge is necessary for the readers to understand the following procedures:
- Any installed Linux distribution, including Kali Linux.
- Prior understanding of the fundamental Linux terminal commands.
Installing the Foremost Data Recovery Tool on Linux
Most Linux default repositories have packages for Foremost that may be installed. Your Linux distribution's package manager can be used to install it from the terminal.
Install Foremost on Debian/Ubuntu/Linux Mint
It is quite simple to install Foremost because it is already available in the repository of all the major Linux distributions. We need to use the package manager for our preferred distribution. On Debian and Ubuntu, apt can be utilized:
$ sudo apt install foremost
Install Foremost on Fedora
The DNF package manager, which replaced yum in recent versions of Fedora, is used to install packages. The package's name is the same:
$ sudo dnf install foremost
Install Foremost on Arch Linux
Pacman can be used to install Foremost if ArchLinux is being used. You can find the program in the distribution's "community" repository:
$ sudo pacman -S foremost
Recover Deleted Files From USB on Linux Using Foremost
Step 1. Connect the USB drive to the computer to retrieve files from it. To find the path of your USB drive, use the command below to list all the drives on your computer:
sudo fdisk -l
Step 2. Scroll down to the location of your USB and copy the file path. Execute the command below to begin the file recovery process.
sudo foremost -v -t jpg,pdf,mp4,exe -q -i /dev/sdc -o /home/Desktop/recover -T
- The -t flag identifies the file types to be recovered.
- The -o flag specifies the output file path.
- The -i flag specifies the drive from which you want to recover files. Change the USB path to yours.
Step 3. Once the recovery process is finished, the restored files will be placed in the output file location. You may need to be patient as the operation may take longer than expected due to the size of the drive.
The result above shows a folder called recover in your Linux desktop. All files recovered by the Foremost will be stored in this folder.
Recover Deleted Files From Hard Disk on Linux Using Foremost
Step 1. Use the following command to list all the drives connected to your device:
sudo fdisk -l
This command will list all the drives attached to your computer and their partitions.
Step 2. There are two methods for recovering files from a hard drive using Foremost:
- Recover files from the entire hard drive
- Recover files from a specific partition
Use the following command to recover files from a single partition:
sudo foremost -v -t png,mp4,pdf -i /dev/sda -o /home/Desktop/recover -T
Change the hard drive path to your own. The path can be found in the output of the command used to list drives.
Step 3. Run this command to retrieve all the files that Foremost file recovery supports:
sudo foremost -v -q -i /dev/sdc
The disk path above should be changed to point to the drive where you want to recover files. The command mentioned above will automatically create the output folder output. The folder will be located in the home directory of your Linux device.
Part 3. The Best Alternative to Foremost for Linux Data Recovery
Foremost is a popular open-source tool for recovering deleted files on Linux systems. However, it has some limitations. For example, it can only recover specific file types and has a complicated data recovery process.
An alternative to consider is Wondershare Recoverit Linux File Recovery. It is a powerful GUI tool that can recover various file types, including photos, videos, documents, and audio files. Additionally, it has a user-friendly interface that makes it easy to use, even for those who need to be tech-savvy. This software can also recover data from storage devices like hard drives, USB drives, memory cards, and more. It also supports ext4 and BTRFS file system recovery.
Wondershare Recoverit - Your Safe and Reliable Linux Recovery Software
5,481,435 people have downloaded it.
Recovers lost or deleted documents, photos, videos, music, emails, and other 1000+ file types effectively, safely, and completely.
Compatible with all mainstream Linux distros, including Ubuntu, Linux Mint, Debian, Fedora, Solus, Opensuse, Manjaro, etc.
Assists in 500+ data loss scenarios, such as deletion, disk formatting, OS crash, power outage, virus attack, lost partition, and many more.
The simple point-and-click interface allows you to recover data from Linux hard drives in just a few clicks.
Works through a remote connection. You can recover lost data even when your Linux device is crashed.
Here is a step-by-step tutorial for using Wondershare Recoverit Linux Recovery to do data recovery so you can quickly recover your crucial files.
Step 1. Choose Linux Recovery
Open Wondershare Recoverit after downloading and installing it on your Windows or Mac PC. Pick NAS and Linux as the first choice, and then click Linux Recovery.
Step 2. Get a Connection remotely
For a remote connection between this Foremost alternative and the Linux computer, fill out the relevant fields. Press the Connect button when you're done. Then, Recoverit will carry out an automated search for missing files.
Step 3. File Recovery
The duration of the scanning process depends on how much data is being scanned. The bottom bar shows the scanning status. Once you've found the file you wish to recover, you can stop searching.
You can see the files after the scanning is complete to ensure they contain the data you wish to recover. Then, click Recover.
You can follow the software's instructions to choose a spot to save the recovered files. Click Recover to get the restored data.
For Windows XP/Vista/7/8/10/11
For macOS X 10.10 - macOS 13
This guide has covered several methods for recovering deleted files using the Foremost Linux File recovery tool. Note that there are no assurances that Foremost will be able to restore any deleted or lost data. However, there are alternative Linux recovery solutions that you can try if Foremost doesn't work for you. The top option for this is the powerful Wondershare Recoverit Linux Recovery. Download it now!