finds installed packages marked to be purged.
% dpkg -l '*' | grep "^i[^i]"
|
lists packages marked for installation, that aren't
installed yet.
% dpkg -l \* | grep '^[^i]i'
|
shows installed packages that are marked for anything but
installation (i.e.uninstallation or purgery). See
man grep
for more info on
grep
and
man dpkg for more on the listing format.
On my system, to find out which apt packages I have
installed, I can do this:
% dpkg -l \*apt\*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name Version Description
+++-=================-=================-=============================================================
ii apt 0.3.19 Advanced front-end for dpkg
ii apt-move 3.0-13 Move cache of Debian packages into a mirror hierarchy
ii aptitude 0.0.4a-4.1 Console based apt frontend
un libapt-pkg-dev <none> (no description available)
un libapt-pkg-doc <none> (no description available)
un libapt-pkg2.7 <none> (no description available)
pn task-laptop <none> (no description available)
|
Here, dpkg displays its headers, and then
shows all packages that have "apt" anywhere in the title.
The three libapt-* packages are not installed
(I've hilighted the "apt" strings that belong to
non-apt packages, so you can see why they showed
up. Interesting, no?)
For a slightly different approach, how about this:
% dpkg -l \* | grep apt
ii apt 0.3.19 Advanced front-end for dpkg
ii apt-move 3.0-13 Move cache of Debian packages into a mirror hierarchy
ii aptitude 0.0.4a-4.1 Console based apt frontend
un libapt-pkg-dev <none> (no description available)
un libapt-pkg-doc <none> (no description available)
un libapt-pkg2.7 <none> (no description available)
ii libpcap0 0.4a6-3 System interface for user-level packet capture.
pn task-laptop <none> (no description available)
%
|
Here I asked to see ALL packages (
dpkg -l \*)
and thenI used
grep to display only those lines
from the output that contained "apt". The headers disappeared, since
none of them contain "apt" -- so
grep discards
them.
% dpkg -L mysql
% dpkg -L apt
|
(with an upper-case EL) shows all the files -- with full
path names -- that are provided by the package.