In this article, we would cover how to search installed files from an Ubuntu package. Sometimes, we need to know what all files our package has installed for various reasons. Either we get the list online from Ubuntu website. Or, we can utilize apt-file command-line utility.
But, before we could use the apt-file command-line utility. We have to install the relevant packages first.
Note: Following operations would require you to have superuser privileges. In case you don’t have one then, we advise you to contact your System Administrator for assistance.
Install apt-file in Ubuntu
Since, the package is available through standard Ubuntu repository. Therefore, update the repository first. This ensures we get to have the latest version of package available. Hence, open a terminal and issue the following –
sudo apt update
Next, to install apt-file –
sudo apt install apt-file
Thereafter, run the following to generate a database. We use the same command to update database –
sudo apt-file update
Now, to list files for a particular package, we can use –
apt-file list <package_name>
For instance,
apt-file list sddm
The output would display list of all the files which are available through the package. It also shows us the installation location. Now, you may wonder how is this useful to us?
Let’s say we want to edit a configuration file of some package. What if we don’t remember where the configuration file is stored. Or, the package developer may have updated the package and now we can’t find the configuration file anymore. In those cases, apt-file list would definitely assist us. There could just be numerous reasons for using apt-file.
apt-file works with all the packages, even with those with are not yet installed.
In conclusion, we have discussed how to search installed files from an Ubuntu package.
Additional Info –
Sometimes, we remember the file name but don’t know the package it is associated with. In those cases, issue the following in terminal –
apt-file search <search_term>
It will show us the package in which a particular file is available. For instance,
apt-file search sddm.conf