The Computer Oracle

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

-------------------------------------------------------------------------------
Become or hire the top 3% of the developers on Toptal https://topt.al/25cXVn
-------------------------------------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Hypnotic Puzzle4

--

Chapters
00:00 Question
00:29 Accepted answer (Score 57)
00:45 Answer 2 (Score 39)
01:16 Answer 3 (Score 13)
01:47 Answer 4 (Score 5)
02:27 Thank you

--

Full question
https://superuser.com/questions/191464/a...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#debian #aptitude

#avk47



ACCEPTED ANSWER

Score 57


try dpkg -l

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




ANSWER 2

Score 39


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'



ANSWER 3

Score 13


Other command can be:

apt-show-versions

It also gives you info about the package state (up to date, upgradable, ...) and about the origin distribution (wheezy, jessie, ...). One can easily filter out packages which came from backports or other exotic repositories.

This program is packaged separately. Install it first with:

apt-get install apt-show-versions



ANSWER 4

Score 4


To list the names of each installed package, type as any user:

dpkg --get-selections

You will get an output like this :

accountsservice              install
aclinstall                   install
acpi-supportinstall          install
acpidinstall                 install
...

To remove the unecessary "install" character string, you can use sed :

dpkg --get-selections | sed 's:install$::'

And if yout want to save it to a file called InstalledPackages, you type this :

dpkg --get-selections | sed 's:install$::' > InstalledPackages