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

Friday, November 27, 2009 posted by Till

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.

Installation

apt-get install apt-file

Usage example

search for the file /etc/sysctl.conf

apt-file search /etc/sysctl.conf

result:

apt-file search /etc/sysctl.conf
procps: /etc/sysctl.conf
mypc:~#

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



One Response to “Find the .deb package that contains a specific file on Ubuntu or Debian Linux”

  1. voku says:

    dpkg -S /etc/sysctl.conf

Leave a Reply

*