How to count the number of packages installed on your Ubuntu/Debian machine.

This useful command will display a count of all installed packages on your Debian Linux machine.

[email protected]:~$ dpkg-query -l | wc -l

Grepping the output to find certain packages.

[email protected]:~$ dpkg-query -l | grep vim
ii  vim-common                                            2:7.4.052-1ubuntu3                                  amd64        Vi IMproved - Common files
ii  vim-tiny                                              2:7.4.052-1ubuntu3                                  amd64        Vi IMproved - enhanced vi editor - compact version

Get the status of a single packages with this command.

[email protected]:~$ dpkg-query -s vim-common
Package: vim-common
Status: install ok installed
Priority: important
Section: editors
Installed-Size: 317
Maintainer: Ubuntu Developers <>
Architecture: amd64
Source: vim
Version: 2:7.4.052-1ubuntu3
Depends: libc6 (>= 2.3.4)
Recommends: vim | vim-gnome | vim-gtk | vim-athena | vim-nox | vim-tiny
 /etc/vim/vimrc b458e7b28b9bc2d04bd5a3fd0f8d777e
Description: Vi IMproved - Common files
 Vim is an almost compatible version of the UNIX editor Vi.
 Many new features have been added: multi level undo, syntax
 highlighting, command line history, on-line help, filename
 completion, block operations, folding, Unicode support, etc.
 This package contains files shared by all non GUI-enabled vim
 variants (vim and vim-tiny currently) available in Debian.
 Examples of such shared files are: manpages, common executables
 like xxd, and configuration files.
Original-Maintainer: Debian Vim Maintainers <>

List all files owned by a certain package.

[email protected]:~$ dpkg-query -L vim-common

No comments have been made. Use this form to start the conversation :)

Leave a Reply