Tip #815   Matching files and packages in Debian/Ubuntu

To find out what files a package generated during installation.

dpkg -L packagename

We can also check the other way and find out what package a file belongs to:

dpkg -S /path/to/file

For the second command we need to use the full path as 'dpkg -S' just matches the string you supply it, so 'dpkg -S ls' matches any package that has a file with 'ls' anywhere in the filename.