How can I recognise in ubuntu from which package was command installed?
2 Answers
dpkg -S filename will find the package that filename came from. Use the full path. Searching for /usr/sbin/apache2 will find just that file, but searching for apache2 will give a long list.
To find the full path of a command use which as in which apache2.
You can also search the .list files in /var/lib/dpkg/info. This directory also lists the confiration files in the .confiles files. File names consist of the package name with a extension indicating the contents. This is likely the directory that the dpkg searches.
- 11,119
One way of doing this (sometimes) is to run "apt-cache search <command>", which sometimes displays the package name. Don't quote me on this, but I think this depends on the information given in the verbose description of the package in the APT-repository. It might be the names of the files in the .deb-package, but that's less likely.
This is the method I use at least, and it works most of the time. Otherwise, Google usually helps.
- 300
whichwon't find it. You could uselocate(orfind) to find it in that case. – Dennis Williamson Jan 15 '11 at 18:13dpkg -S $(which filename)should work if you only know the short filename and not the full path, at least for an executable program. – frabjous Jan 15 '11 at 18:14