The Computer Oracle

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

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------


Take control of your privacy with Proton's trusted, Swiss-based, secure services.
Choose what you need and safeguard your digital life:
Mail: https://go.getproton.me/SH1CU
VPN: https://go.getproton.me/SH1DI
Password Manager: https://go.getproton.me/SH1DJ
Drive: https://go.getproton.me/SH1CT


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

--

Chapters
00:00 Apt-Cache: How To List All Installed Packages With Version Number?
00:19 Accepted Answer Score 57
00:31 Answer 2 Score 39
00:58 Answer 3 Score 4
01:30 Answer 4 Score 13
01:53 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