Ubuntu whatprovides equivalent

On RHEL/CentOS systems, I am used to being able to use the whatprovides command to find what package contains a specific binary. On Ubuntu the best equivalent I have found is the apt-file command. This is not installed by default:

root@backuppc:~# apt install apt-file

Once installed, you might need to update its cache before the first use:

root@backuppc:~# apt-file update

To find out what package provides the mkpasswd binary, I can issue the following:

root@backuppc:~# apt-file search mkpasswd

The output for this command is shown below:

root@backuppc:~# apt-file search mkpasswd
charybdis: /usr/bin/charybdis-mkpasswd
charybdis: /usr/lib/charybdis/modules/extensions/m_mkpasswd.so
expect: /usr/bin/expect_mkpasswd
expect: /usr/share/man/man1/expect_mkpasswd.1.gz
grub-common: /usr/bin/grub-mkpasswd-pbkdf2
grub-common: /usr/share/man/man1/grub-mkpasswd-pbkdf2.1.gz
ircd-irc2: /usr/sbin/ircd-mkpasswd
ircd-irc2: /usr/share/man/man8/ircd-mkpasswd.8.gz
libstring-mkpasswd-perl: /usr/bin/mkpasswd.pl
libstring-mkpasswd-perl: /usr/share/doc/libstring-mkpasswd-perl/changelog.Debian.gz
libstring-mkpasswd-perl: /usr/share/doc/libstring-mkpasswd-perl/copyright
libstring-mkpasswd-perl: /usr/share/lintian/overrides/libstring-mkpasswd-perl
libstring-mkpasswd-perl: /usr/share/man/man1/mkpasswd.pl.1p.gz
manpages-zh: /usr/share/man/zh_CN/man1/mkpasswd.1.gz
manpages-zh: /usr/share/man/zh_TW/man1/mkpasswd.1.gz
whois: /usr/bin/mkpasswd
whois: /usr/share/man/man1/mkpasswd.1.gz

The last two lines indicate whois provides the mkpasswd binary.

Some people report that you can use dpkg -S for the same thing but this doesn’t help here.

root@backuppc:~# dpkg -S mkpasswd
grub-common: /usr/bin/grub-mkpasswd-pbkdf2
grub-common: /usr/share/man/man1/grub-mkpasswd-pbkdf2.1.gz

I hope this helps someone one there! 🙂

Be the first to comment

Leave a Reply