How To Search Packages Based On Files In Ubuntu

Dear linux geeks,

In this tutorial I will teach you how to find the exact package name based on the name of a file you know. This is very helpful when you want to install and use files you know, but have no idea about the name of the package that has these files. To track down the name of the package that has a particular file we will use the apt-file tool.

The apt-file tool lets you search through a package database and prints out the name of the package that contains  a specified file.  It can be installed with the following command.

sudo apt-get install apt-file

After the installation is finished you should update the apt-file’s database with the following command.

sudo apt-file update

The update will take a while and depending on the speed of your internet connection it may take alot of time. Once the update is finished you can find packages based on the file’s they contain with the following command.

apt-file search file_name