According to man pages:
apt-file is a command line tool for searching packages for the APT packaging system.
So let’s proceed:
apt-get install apt-file
apt-file update
The first command will install apt-file and the second command will fetch the content of the packages from the repositories specified in /etc/apt/sources.list and will resynchronize the contents from the sources.
Now give it a try:
apt-file -v search /usr/sbin/postfix
D: got ‘deb http://192.168.1.2:9999/debian/ etch main contrib non-free’
D: kept ‘deb http://192.168.1.2:9999/debian/ etch main contrib non-free’
D: regexp: ^(.*?usr/sbin/postfix[^s]*)s+(S+)s*$
D: Search in /var/cache/apt/apt-file/192.168.1 .2_debian_dists_etch_Contents-i386.gz
…
postfix: usr/sbin/postfix
postfix-policyd: usr/sbin/postfix-policyd
postfix-policyd: usr/sbin/postfix-policyd-cleanup
Note that you can get similar information by typing this:
dpkg -S /usr/sbin/postfix
postfix: /usr/sbin/postfix
The difference, however, is that apt-file provides information even if the package is not installed or was uninstalled.
Tags: Linux