I frequently need to check which packages are installed, and I use the following command:
dpkg -l | grep foo
which gives the following output
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Description
ii foo <version> <description>
- What does the
ii
mean? - What other flags are there?
- How to read the flags? (because the explanation is quite complicated, IMO)
Thanks.
Where to find this information in the system
You can find this information out in the head of dpkg -l output, as it's just a formatting convention:
Copied here for reference:
Description of each field
As you can see from the first three lines:
First letter -> desired package state ("selection state"):
Second letter -> current package state:
Third letter -> error state (you normally shouldn't see a third letter, but a space, instead):
The first letter displays what is the expected status of the package.
The second letter displays what is the current status of the package.
So for example:
ii
means 'It should be installed and it is installed' whereasrc
means 'It's removed/uninstalled but it's configuration files are still there'Because my rep is low, I cannot comment to answer the questions people have about where to get this info. After reviewing source code for dpkg and related programs' main.c code, I found what I was looking for.
The info for reading the -l | --list output is in
and not in
dpkg is merely acting as the front-end in these instances
It means that the package is desired to be installed and that the package is installed.
See
man dpkg-query
Upper case letters shown in the alternatives after equals sign in the three first lines in the legend are the letters possibly shown shown as the first three characters in the first field, respectively, but not all of them in the same case i.e some of the letters are shown in lower case. The third character is space normally.