Meta packages are packages that do not install anything by themselfs, but are dependent on other packages. How do I list the installed meta packages on my system?

  • I think there's no other way than the brute force one: check all installed packages and report those whose installed files are only /usr/share/doc/$pkg/(copyright|changelog)*. – angus Jan 21 '12 at 23:30

Try the following command, that list the name of every installed package that has the string "metapackage" in its section field in apt-cache show output:

apt-cache show $(dpkg-query -Wf '${Package}\n') | 
  awk '$1 == "Package:" { pkg = $2 }; 
       $1 == "Section:" && $2 ~ /metapackage/ { print pkg }'
  • Maybe you mean “Description” field? But then, there is also (at least) “meta-package” and “meta package”... – angus Jan 22 '12 at 11:25
  • @angus: no, I mean exactly section field: at least in Debian and in Ubuntu real metapackages are in section metapackages and multiverse/metapackages. – enzotib Jan 22 '12 at 11:30
  • Isn't (for example) emacs a metapackage? I have it in section “editors”. Its description says: “The GNU Emacs editor (metapackage)”. (?) What's an example of a package in section “metapackage”? I couldn't find any :-/. – angus Jan 22 '12 at 14:23
  • OK, with perl -n00e 'print if /^Section: .*metapackage/m' /var/lib/apt/lists/*Packages I found 4 of them. I don't think it's a very reliable method... – angus Jan 22 '12 at 14:37

I used:

apt-cache search . | grep -i "metapackage\|meta-package"

combined with:

dpkg --get-selections

in the following script:

awk 'BEGIN{
    FS=" - ";
    findmeta="apt-cache search . | grep -i \"metapackage\|meta-package\"";
    while ((findmeta | getline) > 0) meta[$1]=$2;
    FS=" ";
    findinstalled="dpkg --get-selections";
    while ((findinstalled | getline) > 0) {
        if ($1 in meta) print $1" - "meta[$1]

On one line:

awk 'BEGIN{FS=" - ";findmeta="apt-cache search . | grep -i \"metapackage\|meta-package\""; while ((findmeta | getline) > 0) meta[$1]=$2; FS=" "; findinstalled="dpkg --get-selections"; while ((findinstalled | getline) > 0) {if ($1 in meta) print $1" - "meta[$1]}}'

Example results:

emacs - GNU Emacs editor (metapackage)
exim4 - metapackage to ease Exim MTA (v4) installation
linux-headers-amd64 - Header files for Linux amd64 configuration (meta-package)
linux-image-amd64 - Linux for 64-bit PCs (meta-package)
xfce4 - Meta-package for the Xfce Lightweight Desktop Environment
xserver-xorg-input-all - X.Org X server -- input driver metapackage

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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