Find the .deb package that contains a specific file on Ubuntu or Debian Linux

Sometimes you need to know to which debian or ubuntu package a specific file belongs, e.g. because you deleted a system file and want to reinstall it. There is a handy utility called apt-file which searches for a filename in all debian packages.


apt-get install apt-file

Usage example

search for the file /etc/sysctl.conf

apt-file search /etc/sysctl.conf


apt-file search /etc/sysctl.conf
procps: /etc/sysctl.conf

Now we see that the file is part of the debian / ubuntu package with the name "procps".

Leave a Comment