6 C
Senior Writer and partner

Foremost is a great tool for recover files on Linux

Linux has fantastic tools that we can apply to our daily work. Whether you work on a server or simply on your personal computer. Sometimes at work, we can make several mistakes when working with files. For example, delete a file we should not have. Or format a flash drive that contains important information that we then need. That’s why today I will show you how to install and use Foremost an extraordinary tool to recover files on Linux.


Foremost is a console program to recover files based on their headers, footers, and internal data structures.

The application is a guarantee of clairvoyance since it was initially developed by a U.S. government entity but its code was released. It is inspired in technical applications of forensic laboratories. Again, it is important to say that it is very reliable.

Supports a large number of default file formats such as jpg, gif, png, bmp, avi, tiff, mp4, exe, mpg, wav, asf, wma, mp3, fws, riff, wmv, mov, pdf, ole, doc, docx, xls, xlsx. ppt, pptx, zip, rar, html, cpp, java, art,pst, ost, dbx, idx, mbx, wpc, pgp, txt, rpm, dat, etc. Besides all this, it is possible to add other formats if we edit the configuration file of the application that is /etc/foremost.conf.

Install and use Foremost to recover files on Linux

The application is available to be installed in the Debian, Ubuntu and their derivatives defect repositories. So if you use one of these Linux distributions, just use the following command to install Foremost:

:~$ sudo apt install foremost

1.- Install Foremost
1.- Install Foremost

Once you have entered the password, the download and installation of the program will begin. Everything is quite simple.

If you use CentOS 7, then an extra distribution repository must be enabled. To do this, run the following command:

:~$ su
:~# rpm -Uvh http://repository.it4i.cz/mirrors/repoforge/redhat/el7/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm

Then we can install Foremost with the following command:

:~# yum install foremost

Now, you can start to recover files on Linux.

The use of the application is quite simple. However, it is recommended that where we are going to save the recovered files is on a different partition or even on another disk. In addition, it is recommended to create a folder that is empty to store the recovered files.

The basic form of use of the application is as follows:

:~$ sudo foremost -v -t [format] -i [input_folder_or_path] -o [output_folder]

For example:

2.- Using Foremost to recover files on Linux
2.- Using Foremost to recover files on Linux

In that case, I am looking for and recovering all .pdf files from the /dev/sda4 disk to a folder called recover on my current system. As you can see it is simple.

Finally, I recommend that you check the Foremost man page for more information on the application.

:~$ man foremost

3.- Man page of foremost
3.- Man page of foremost

So, enjoy it.


Recovering files on Linux is a good thing to know. Especially at this time where we have a lot of work and can make involuntary mistakes that could be very expensive. So as you can see, it’s very easy to do.

Please share this post with your friends, it is important information that can help many.

- Advertisement -


Please enter your comment!
Please enter your name here

Donate to Osradar

Latest article