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?
2 Answers
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
-
I can confirm that the first command above works and it really finds metapackages. Thank you. Jan 22, 2022 at 11:01
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”...– angusJan 22, 2012 at 11:25
-
@angus: no, I mean exactly section field: at least in Debian and in Ubuntu real metapackages are in section
metapackages
andmultiverse/metapackages
.– enzotibJan 22, 2012 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 :-/.– angusJan 22, 2012 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...– angusJan 22, 2012 at 14:37
/usr/share/doc/$pkg/(copyright|changelog)*
.