Our earlier articles on Ubuntu package management explore ways to use deb packages efficiently. In this article we will walk through some useful apt and dpkg options to inspect a package closely.
- Let’s start by checking if a package is installed or available in the repos.
$ dpkg -l leafpad Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Description +++-===============================-====================-====================-=========== ii leafpad 0.8.18.1-4 amd64 GTK+ based simple text editor
$ dpkg -l firefox Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Description +++-===============================-====================-====================-=========== un firefox (no description available)
$ dpkg -l trimage dpkg-query: no packages found matching trimage
- Inspect details of an installed package using dpkg.
$ dpkg -s leafpad Package: leafpad Status: install ok installed Priority: optional Section: editors Installed-Size: 719 Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> Architecture: amd64 Version: 0.8.18.1-4 Depends: libc6 (>= 2.4), libcairo2 (>= 1.2.4), libglib2.0-0 (>= 2.24.0), libgtk2.0-0 (>= 2.10.0), libpango-1.0-0 (>= 1.14.0), libpangocairo-1.0-0 (>= 1.14.0) Suggests: evince-gtk Description: GTK+ based simple text editor Leafpad is a simple GTK+ based text editor, the user interface is similar to Notepad. It aims to be lighter than GEdit and KWrite, and to be as useful as them. Original-Maintainer: Jari Aalto <jari.aalto@cante.net> Homepage: http://tarot.freeshell.org/leafpad/
- Inspect details of a package available in the repos using apt.
$ apt-cache show leafpad Package: leafpad Priority: optional Section: universe/editors Installed-Size: 719 Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> Original-Maintainer: Jari Aalto <jari.aalto@cante.net> Architecture: amd64 Version: 0.8.18.1-4 Depends: libc6 (>= 2.4), libcairo2 (>= 1.2.4), libglib2.0-0 (>= 2.24.0), libgtk2.0-0 (>= 2.10.0), libpango-1.0-0 (>= 1.14.0), libpangocairo-1.0-0 (>= 1.14.0) Suggests: evince-gtk Filename: pool/universe/l/leafpad/leafpad_0.8.18.1-4_amd64.deb Size: 109522 MD5sum: c60236da8611f855a8997e57a6b73f58 SHA1: 0b8161af15b019a6a70d7f72192c17991149f428 SHA256: abc35db624fd31643e0b492c0e273ae72c51995278fdf273052e41dc7eecab17 Description: GTK+ based simple text editor Description-md5: 740212fcff65af346fc49b9f4840390a Homepage: http://tarot.freeshell.org/leafpad/ Bugs: https://bugs.launchpad.net/ubuntu/+filebug Origin: Ubuntu Supported: 3y Task: lubuntu-desktop
- Inspect details of a .deb installer archive file.
$ dpkg -I XnViewMP-linux-x64.deb new debian package, version 2.0. size 27860094 bytes: control archive=384 bytes. 220 bytes, 9 lines control 75 bytes, 4 lines * postinst #!/bin/sh Package: xnview Version: 0.72 Architecture: amd64 Installed-Size: 16 Section: graphics Priority: optional Maintainer: None <none@none.com> Homepage: http://www.xnview.com Description: Graphic viewer, browser, converter.
- List files from an installed package.
$ dpkg -L libjpeg8 /. /usr /usr/share /usr/share/doc /usr/share/doc/libjpeg8 /usr/share/doc/libjpeg8/copyright /usr/share/doc/libjpeg8/changelog.Debian.gz
- List files to be installed by a .deb installer archive file.
$ dpkg -c zram-config_0.1_all.deb drwxr-xr-x root/root 0 2012-01-17 21:05 ./ drwxr-xr-x root/root 0 2012-01-17 21:05 ./usr/ drwxr-xr-x root/root 0 2012-01-17 21:05 ./usr/share/ drwxr-xr-x root/root 0 2012-01-17 21:05 ./usr/share/doc/ drwxr-xr-x root/root 0 2012-01-17 21:05 ./usr/share/doc/zram-config/ -rw-r--r-- root/root 974 2012-01-09 16:40 ./usr/share/doc/zram-config/copyright -rw-r--r-- root/root 163 2012-01-09 19:19 ./usr/share/doc/zram-config/changelog.gz drwxr-xr-x root/root 0 2012-01-17 21:05 ./etc/ drwxr-xr-x root/root 0 2012-01-17 21:05 ./etc/init/ -rw-r--r-- root/root 1072 2012-01-09 18:59 ./etc/init/zram-config.conf drwxr-xr-x root/root 0 2012-01-17 21:05 ./etc/init.d/ lrwxrwxrwx root/root 0 2012-01-17 21:05 ./etc/init.d/zram-config -> /lib/init/upstart-job