You want dpkg-query
;
For dpkg-query
>= 1.17.11:
dpkg-query -f '${Package}\t${db:Status-Status}\n' -W '*'
For dpkg-query
< 1.17.11:
dpkg-query -f '${Package} ${Status}\n' -W '*' | awk '{print $1"\t"$4}'
#1:
-f '${Package}\t${db:Status-Status}\n'
: When used with the -W
option, specifies the format of the output (see man dpkg-query
for other options);
-W '*'
: lists all the packages matching the pattern *
;
#2:
-f '${Package} ${Status}\n'
: When used with the -W
option, specifies the format of the output (see man dpkg-query
for other options);
-W '*'
: lists all the packages matching the pattern *
;
awk '{print $1"\t"$4}'
: prints only the first and fourth field;
In this case it seems like you want to list the status word, so I picked the db:Status-Status
virtual field; here are the other virtual fields related to the package status:
db:Status-Abbrev
It contains the abbreviated package status, such as "ii"
(since dpkg 1.16.2).
db:Status-Want
It contains the package wanted status, part of the Status
field (since dpkg 1.17.11).
db:Status-Status
It contains the package status word, part of the Status
field (since dpkg 1.17.11).
db:Status-Eflag
It contains the package status error flag, part of the
Status field (since dpkg 1.17.11).
user@user-X550CL ~/tmp % dpkg-query -f '${Package}\t${db:status-status}\n' -W '*' | head
aalib1 not-installed
account-plugin-aim installed
account-plugin-empathy not-installed
account-plugin-facebook installed
account-plugin-flickr installed
account-plugin-foursquare not-installed
account-plugin-gadugadu not-installed
account-plugin-generic-oauth not-installed
account-plugin-google installed
account-plugin-groupwise not-installed
dpkg --get-selections
output? Why do you run it with.
?dpkg -l
shows the installed packages andapt-cache dump
shows all of them.