Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I can retrieve the softwares using the dpkg command but is there a command to get the associated category for the software . For example if I have Firefox installed can I somehow retrieve a tag for it that says browser or may be a more abstract term say internet tools.

share|improve this question
up vote 4 down vote accepted

You can use dpkg-query and format the output to get the binary name and its Debian section:

dpkg-query -W -f='${binary:Package} (${Section})\n' firefox

For firefox it will simply return firefox (web) (the same section used when querying

Of course you can also use the same command without a package name:

dpkg-query -W -f='${binary:Package} (${Section})\n'

See the dpkg-query man page for further details.

To get the categories as shown in the Software Center you need to parse files in /usr/share/applications like this:

$ grep Categories /usr/share/applications/* | grep firefox

To get only the most specific applicable category, you could try this:

$ grep Categories /usr/share/applications/firefox.desktop | awk -F';' '{print $(NF-1)}'
share|improve this answer
Thanks for spending some of your valuable time with Ask Ubuntu. :) – Raja May 5 '14 at 12:32
I tried the command it returns me web for the firefox but gnome for rhythmbox but when i see software center it lists it under sound and video category .So any other query to produce the same outcome ? – cafebabe1991 May 5 '14 at 12:44
Moreover when i run software-center in debug mode it seems like it queries the software internal tools and gets the categories the way i want them for eg. Ruby python are coming under developer tools and more. Can anything be done about it ? – cafebabe1991 May 5 '14 at 12:51
I've updated my answer using the freedesktop Categories – Sylvain Pineau May 5 '14 at 13:23
Thanks alot. Would not have got a better answer than yours.Very much appreciated. @SylvainPineau – cafebabe1991 May 5 '14 at 14:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.