Apt-cache: How to list all installed packages with version number?

apt-cache dump --installed doesn't work, it lists uninstalled packages as well.

I want to list the install packages each by one line, with the installed version number.


try dpkg -l

it lists you the packages, version and a short description.


The simplest way is using dpkg, but it might show a few extraneous packages and it truncates long package names and version numbers:

dpkg -l

To list only correctly installed packages and not truncate names:

dpkg -l | grep '^ii'

To get more control over the output format, you can use dpkg-query:

dpkg-query -W -f '${status} ${package} ${version}\n' | \
sed -n 's/^install ok installed //p'