Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
    
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

2 Answers 2

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 }'
share|improve this answer
    
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
share|improve this answer

Your Answer

 
discard

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.