apt: how to search using package tags?

Solution 1:

I wonder why people haven't answered:

aptitude search '?tag(protocol::dns)'

aptitude search allows complex search queries with probes on different package description fields and logical operators:

aptitude search '?tag(game::strategy) ?installed'
aptitude search '?tag(protocol::dns) !?installed'

Refer to Search term reference in Aptitude User's Manual from aptitude-doc-en package (/usr/share/doc/aptitude/html/en/index.html).

Solution 2:

You probably want to take a look at all the documentation surrounding Debtags. It's... not as simple as you might think. No, I don't know why, either.

Solution 3:

Use axi-cache from the apt-xapian-index package. You can, for example do axi-cache search --all protocol::smtp. The tab-completion for axi-cache is extremely advanced, so hit tab often. For example, axi-cache search --all protocol::smtp <tab><tab> will show you what other tags you might want based on the fact that you already specified the first.

Solution 4:

If you install debtags, you can use it to search for tags like this:

debtags search made-of::icons
debtags search "made-of::icons && x11::theme"
debtags tagcat               # Shows all tags and their description
debtags tagshow x11::TODO    # Shows a single tag plus description

debtags also comes with a nice bash tab completion.