Você quer dpkg-query ;
Para dpkg-query > = 1.17.11:
dpkg-query -f '${Package}\t${db:Status-Status}\n' -W '*'
Para 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': quando usado com a opção-W, especifica o formato da saída (consulteman dpkg-querypara outras opções); -
-W '*': lista todos os pacotes que correspondem ao padrão*;
# 2 :
-
-f '${Package} ${Status}\n': quando usado com a opção-W, especifica o formato da saída (consulteman dpkg-querypara outras opções); -
-W '*': lista todos os pacotes que correspondem ao padrão*; -
awk '{print $1"\t"$4}': imprime apenas o primeiro e o quarto campo;
Nesse caso, parece que você deseja listar a palavra de status, por isso, escolhi o campo db:Status-Status virtual; aqui estão os outros campos virtuais relacionados ao status do pacote:
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