Specific notes for the Debian package system.

What Package Installed This File?

The simple way with exact matches.

$ dpkg -S $(which column)
bsdmainutils: /usr/bin/column

Or you could use the apt-file utility (from the package of the same name).

$ apt-file search $(which column)
autogen: /usr/bin/columns
bsdmainutils: /usr/bin/column

Information About A Package

Succinct Information
$ dpkg-query -l bsdmainutils
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  bsdmainutils   9.0.6        amd64        collection of more utilities from
Comprehensive Information
$ apt-cache show bsdmainutils
Package: bsdmainutils
Version: 9.0.6
Installed-Size: 571
Maintainer: Debian Bsdmainutils Team <pkg-bsdmainutils@teams.debian.net>
Architecture: amd64
Depends: libc6 (>= 2.14), libncurses5 (>= 5.5-5~), libtinfo5, bsdutils (>= 3.0-0), debianutils (>= 1.8)
Suggests: cpp, wamerican | wordlist, whois, vacation
Breaks: bsdutils (<< 1:2.13-11)
Description-en: collection of more utilities from FreeBSD
 This package contains lots of small programs many people expect to find when
 they use a BSD-style Unix system.
 .
 It provides banner (as printerbanner), calendar, col, colcrt, colrm, column,
 from (as bsd-from), hexdump (or hd), look, lorder, ncal (or cal), ul, and
 write (as bsd-write).
 .
 This package used to contain whois and vacation, which are now distributed in
 their own packages. Also here was tsort, which is now in the "coreutils"
 package.
Description-md5: 156725110b9d8b7a144a6b1a40ed5446
Multi-Arch: foreign
Tag: implemented-in::c, interface::commandline, interface::text-mode,
 role::program, suite::bsd, uitoolkit::ncurses
Section: utils
Priority: important
Filename: pool/main/b/bsdmainutils/bsdmainutils_9.0.6_amd64.deb
Size: 183214
MD5sum: 7fd92f542150e553b152b9e5a48fd2f1
SHA1: b9573ed2e7d687f448bb1c5b12e00dc35c4b6dfa
SHA256: afaa9217a2454f03021fa57653779470a12d89d747d8e318b9f97af36a52fbdd

What Files Does The Package Include

What exact files did that apt-get install just install?

dpkg -L package

This will list the files that are installed which are associated with the specified package.

Did you use an apt thing to install a package and you have no idea where it is or even if its package file has been retained? This will show you the files on the file system put there by the named package installation.

dpkg-query -L package

If you have the deb package downloaded as a file you can use this to find out what’s in it.

dpkg --contents firmware-realtek_20161130-5_all.deb

Need to extract a single file from a deb? Try this.

dpkg --fsys-tarfile firmware-realtek_20161130-5_all.deb | \
tar xOf - ./lib/firmware/rtlwifi/rtl8821aefw.bin > rtl8821aefw.bin

How Can I Get The Files In This Package Without Installing

This is especially important if the deb seems sketchy or you don’t have superuser privileges on a system.

I turns out that deb package files are archived using the normal ar command. This means you can extract the contents with something like this.

ar -xv definitelynotmalware.deb

This may contain a normal tar file that has the files you are generally looking for.

What Packages Are Installed On The System?

What are all of the packages installed? This is handy for when you installed that program that did that thing but you forgot what it was called.

$ dpkg --get-selections | grep ^bsd
bsd-mailx                   install
bsdmainutils                    install
bsdutils

Show Dependencies

$ apt-cache depends bsdmainutils | grep 'Depends:'
  Depends: libc6
  Depends: libncurses5
  Depends: libtinfo5
  Depends: bsdutils
  Depends: debianutils