[lug] Command line challenge: list all debian packages in a section

Jed S. Baer blug at jbaer.cotse.net
Wed May 2 14:11:38 MDT 2018


I just tried to figure out how to do this. Seems it should be easy, eh?

$ dpkg-query -W -f='${package}|${section}\n' '*'| grep -i ham
aldo|hamradio
chirp-daily|hamradio
cqrlog|hamradio
cw|hamradio
cwcp|hamradio
hamlib-utils|
hamlib1|
hamlib2|
hamlib3|
hamlib4|
libhamlib-utils|hamradio
libhamlib2|libs
morse|hamradio
morse-x|hamradio
qrq|hamradio
xcwcp|hamradio
xlog|hamradio
xlog-data|hamradio

Okay, where's fldigi?

I appears that from the manpage: 'If  no package-name-pattern is given,
list all packages in /var/lib/dpkg/status, excluding the ones marked as
not-installed', one can't infer that in the presence of a pattern,
not-installed packages will be listed.

No doubt there's a way to do this using Perl or Python, and some helpful
library. The question is, can it be done using the supplied dpkg/apt
command line utilities?


More information about the LUG mailing list