If you are managing software on Debian/Ubuntu using apt-get package management, there may be cases where you want to remove or upgrade a software package that contains an existing binary file on your system. So given an existing binary file (e.g., /usr/lib/postgresql/8.4/bin/postgres), how can you find out which package provides the binary file?
This is when apt-file can help you, which is a command-line utility developed for that very purpose. First, install apt-file as follows.
$ sudo apt-file update
In order to find out which package "/usr/lib/postgresql/8.4/bin/postgres" belongs to, do the following.
The above output tells you that the binary file comes from a package called postgresql-8.4.
To remove the found package, as well as its dependencies that were installed along with it but are no longer used by anything else on the system, do the following.
Subscribe to Xmodulo
Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!
Latest posts by Dan Nanni (see all)
- How to install Suricata intrusion detection system on Linux - September 3, 2015
- How to switch from NetworkManager to systemd-networkd on Linux - August 31, 2015
- How to set up a system status page of your infrastructure - August 25, 2015