Debian: Quick dpkg query commands
Here are a few tricks for querying Debian's
dpkg command.
Upgrade or install a package:Code:
# dpkg -i package-name.deb
Listing installed packages in Debian. You can use directly package name after '-l' if you know it's name.:
Code:
# dpkg -l
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name Version Description
+++-============================================-============================-============================================
ii acl 2.2.47-3 Access control list utilities
ii acpi 1.4-2 displays information on ACPI devices
ii acpi-support-base 0.123-1 scripts for handling base ACPI events such a
ii acpid 1.0.10-2 Utilities for using ACPI power management
ii adduser 3.110 add and remove users and groups
Install recursivelly all packages from this directory:Code:
# dpkg -R .
(notice the dot).
Completely remove a package (including configuration files):Code:
# dpkg -P (--purge) package-name.deb
Remove a package leaving it's configuration file intact:Code:
# dpkg -r (--remove) package-name.deb
List all files installed by a certain package:Code:
# dpkg -L initramfs-tools
/.
/var
/var/lib
/var/lib/initramfs-tools
/usr
/usr/sbin
/usr/sbin/update-initramfs
/usr/sbin/mkinitramfs-kpkg
/usr/sbin/mkinitramfs
...............
/etc/initramfs-tools/scripts/local-bottom
/etc/initramfs-tools/scripts/nfs-premount
/etc/initramfs-tools/scripts/init-top
/etc/initramfs-tools/scripts/nfs-top
/etc/initramfs-tools/scripts/init-bottom
/etc/initramfs-tools/scripts/init-premount
Find out by which packages was this file installed:Code:
# dpkg -S `which update-initramfs`
initramfs-tools: /usr/sbin/update-initramfs
List all files included in a .deb file without installing it.Here's how to list the contents of a kernel debian package:
Code:
# dpkg -c /usr/src/linux-image-2.6.26-compiled-tuned_debian.resa.1.0_i386.deb | head
tar: Record size = 8 blocks
drwxr-xr-x root/root 0 2009-08-04 10:53 ./
drwxr-xr-x root/root 0 2009-08-04 10:53 ./boot/
-rw-r--r-- root/root 87142 2009-08-04 10:03 ./boot/config-2.6.26-compiled-tuned
-rw-r--r-- root/root 900061 2009-08-04 10:53 ./boot/System.map-2.6.26-compiled-tuned
-rw-r--r-- root/root 1450992 2009-08-04 10:53 ./boot/vmlinuz-2.6.26-compiled-tuned
drwxr-xr-x root/root 0 2009-08-04 10:53 ./lib/
drwxr-xr-x root/root 0 2009-08-04 10:53 ./lib/modules/
drwxr-xr-x root/root 0 2009-08-04 10:53 ./lib/modules/2.6.26-compiled-tuned/
-rw-r--r-- root/root 391518 2009-08-04 10:53 ./lib/modules/2.6.26-compiled-tuned/modules.alias.bin
-rw-r--r-- root/root 222088 2009-08-04 10:53 ./lib/modules/2.6.26-compiled-tuned/modules.symbols.bin
...................................
List information (dependencies, maintainer, architecture, description) about an installed packageCode:
# dpkg -p virtualbox-ose
Package: virtualbox-ose
Priority: extra
Section: misc
Installed-Size: 22712
Maintainer: Debian Virtualbox Team <pkg-virtualbox-devel@lists.alioth.debian.org>
Architecture: i386
Version: 3.0.2-dfsg-1
Replaces: virtualbox
Provides: virtualbox
Depends: libc6 (>= 2.3.6-6~), libcurl3 (>= 7.16.2-1), libgcc1 (>= 1:4.1.1), libsdl1.2debian (>= 1.2.10-1), libssl0.9.8 (>= 0.9.8f-5), libstdc++6 (>= 4.2.1), libx11-6, libxcursor1 (>> 1.1.2), libxext6, libxml2 (>= 2.6.27), libxmu6, libxslt1.1 (>= 1.1.18), libxt6, python2.5 (>= 2.5), zlib1g (>= 1:1.1.4), adduser, python
Pre-Depends: debconf | debconf-2.0
Recommends: virtualbox-ose-modules, virtualbox-ose-qt, libgl1
Suggests: virtualbox-ose-source, virtualbox-guest-additions
Conflicts: virtualbox
Size: 5891154
Description: x86 virtualization solution - base binaries
VirtualBox is a free x86 virtualization solution allowing a wide range
of x86 operating systems such as Windows, DOS, BSD or Linux to run on a
Linux system.
.
This package provides the binaries for the Open Source Edition of
VirtualBox. The virtualbox-ose-source package is also required in order to
compile the kernel modules needed for virtualbox-ose. A graphical user
interface for VirtualBox is provided by the package virtualbox-ose-qt.
Homepage: http://www.virtualbox.org/