Parse and filter dpkg database to display selected fields or other specific information.
Install Gawk script to parse dpkg databases.
$ sudo apt install dpkg-awk
Display package information.
$ dpkg-awk "package:^vim$"
Package: vim Status: install ok installed Priority: optional Section: editors Installed-Size: 3615 Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> Architecture: amd64 Version: 2:8.2.2434-3ubuntu3.1 Provides: editor Depends: vim-common (= 2:8.2.2434-3ubuntu3.1), vim-runtime (= 2:8.2.2434-3ubuntu3.1), libacl1 (>= 2.2.23), libc6 (>= 2.34), libgpm2 (>= 1.20.7), libpython3.9 (>= 3.9.1), libselinux1 (>= 3.1~), libtinfo6 (>= 6) Suggests: ctags, vim-doc, vim-scripts Description: Vi IMproved - enhanced vi editor 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 a version of vim compiled with a rather standard set of features. This package does not provide a GUI version of Vim. See the other vim-* packages if you need more (or less). Homepage: https://www.vim.org/ Original-Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>
Display package description.
$ dpkg-awk "package:^vim$" -- Description
Description: Vi IMproved - enhanced vi editor 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 a version of vim compiled with a rather standard set of features. This package does not provide a GUI version of Vim. See the other vim-* packages if you need more (or less).
Display package version.
$ dpkg-awk 'package:^tmux$' 'Status: .* installed$' -- Version
Version: 3.1c-1build1
Display package versions for vim.*
packages.
$ dpkg-awk 'package:vim' -- Package Version Status
Package: vim Version: 2:8.2.2434-3ubuntu3.1 Status: install ok installed Package: vim-common Version: 2:8.2.2434-3ubuntu3.1 Status: install ok installed Package: vim-runtime Version: 2:8.2.2434-3ubuntu3.1 Status: install ok installed Package: vim-tiny Version: 2:8.2.2434-3ubuntu3.1 Status: install ok installed
Display available package versions for vim.*
packages.
$ dpkg-awk -f /var/lib/dpkg/available 'package:vim' -- Package Version Status
Package: vim-common Version: 2:8.2.2434-3ubuntu3 Package: vim-tiny Version: 2:8.2.2434-3ubuntu3
Display packages that depends on tmux
.
$ dpkg-awk 'depends:tmux' -- Package Depends
Package: byobu Depends: debconf (>= 0.5) | debconf-2.0, python3:any, gettext-base, iproute2, python3, python3-newt, tmux (>= 1.5), gawk Package: ubuntu-server Depends: apport, bcache-tools, btrfs-progs, byobu, cloud-guest-utils, cloud-initramfs-copymods, cloud-initramfs-dyn-netconf, curl, dirmngr, ethtool, fonts-ubuntu-console, git, gnupg, htop, lvm2, mdadm, motd-news-config, multipath-tools, overlayroot, patch, pollinate, screen, software-properties-common, sosreport, tmux, update-notifier-common, vim, xfsprogs
Unfortunately, this is not the best solution to compare sizes.
$ dpkg-awk 'installed-size:^[1-9][0-9]{5,}$' -- Package Installed-size
Package: cpp-11 Installed-size: 142659 Package: g++-11 Installed-size: 153526 Package: gcc-11 Installed-size: 165634
$ dpkg-awk -- Package Installed-size | awk 'BEGIN{RS="\n\n";FS="\n"} {split($2,size,": ");if(size[2]>8000 && size[2]<10000) print}'
Package: coreutils Installed-size: 8248 Package: udev Installed-size: 9315
According to documentation “the disk space is given as the integer value of the estimated installed size in bytes, divided by 1024 and rounded up”.