Debian: Find package name from program name

722

Back again,
This time it’s Debian’s time, when managing multiple hosts and installations sometimes happens you need to know what package owns a certain utility.

Recently I’ve faced a quite common problem, I’ll take it as an example so it’s more clear, I had a common and popular program “pdftotext” and I wanted to have it into another debian installation, quite easy isn’t it ? you only need to remember what package has it.

While fighting with Ghostscript program and PostScript files was quite easy to check where this utility is, just take a look at ghostscript related packages (with apt-get, aptitute, …) and see where your program could be (guess it…)

In my particular case “pdftotext” (my example) wasn’t inside some package called “ghostscript*” but inside “poppler-utils”; don’t want to blame poppler maintainers but I don’t really remember where the utility was

So while looking at dpkg (Debian father for all CLI packages utilities) command line I was captured by -S switch and here’s my final solution:

mymachine:/# dpkg -S `which pdftotext`
poppler-utils: /usr/bin/pdftotext

And here’s, easy and dirty trick to get information from an utility name, then poppler-utils was my package name and I’ve installed it in the other machine

This goes for Debian, Ubuntu and mainly Debian based distros

 

Easy, isn’t it ?

 

Hope it helps, glad to hear your comments

Andrea (Ben) Benini