Like Dennis said, apt-get is a layer on top of dpkg (or other local package managers such as rpm). dpkg manages the local packages on the machine, while apt-get provides a way to grab packages from distant repositories and resolve dependencies between packages that will be handed to dpkg.
dpkg -L <package_file>
lists the files provided by a package already installed on the machine.
With apt-get, you might want to list the files that a package provides, even if it is not installed in your system. Fortunately for you, there is a tool for that, called apt-file, which needs to be installed in addition to apt-get. You can use it this way:
# Install apt-file
$ sudo apt-get install apt-file
# update apt-file's cache (different than apt-get's, namely apt-cache)
$ sudo apt-file update
# display the contents of a package
$ sudo apt-file list <package_name>
Note that apt-file uses special files on the package repository called Contents files. While all official repositories have these files, some third-party repositories might not have them, so apt-file won't be able to list the contents of packages on these repositories.
man apt-file
will also list other nice things you can do with apt-file, such as apt-file search <keyword> which lets you find which packages provide a given file.
apt-cache can be used for some stuff you might want to do:
Actually listing all packages:
To actually list all packages that is in apt-get's cache, use apt-cache pkgnames. This is very much the equivalent of dpkg -l for apt-get, except it only shows package names, and not any other information that dpkg might show.
NOTE: Using apt-cache pkgnames will generate incredibly much output, on my system it is as much as 39553 lines. To see in advance how many lines it would be on your system, try using apt-cache stats (see below).
Searching:
Use apt-cache search <regex> [<regex> [...]] where <regex> is one or more regular expressions to search for.
Counting:
Use apt-cache stats to show some statistics about that cache since last apt-get update.
For instance, an example output might be:
Total package names: 39553 (1,582k)
Normal packages: 30033
Pure virtual packages: 511
Single virtual packages: 2762
Mixed virtual packages: 305
Missing: 5942
Total distinct versions: 32378 (1,813k)
Total distinct descriptions: 32378 (777k)
Total dependencies: 210651 (5,898k)
Total ver/file relations: 34931 (559k)
Total Desc/File relations: 32378 (518k)
Total Provides mappings: 5816 (116k)
Total globbed strings: 169 (2,278)
Total dependency version space: 1,052k
Total slack space: 73.4k
Total space accounted for: 10.0M
Like Dennis said,
apt-get
is a layer on top ofdpkg
(or other local package managers such asrpm
).dpkg
manages the local packages on the machine, whileapt-get
provides a way to grab packages from distant repositories and resolve dependencies between packages that will be handed todpkg
.lists the files provided by a package already installed on the machine.
With apt-get, you might want to list the files that a package provides, even if it is not installed in your system. Fortunately for you, there is a tool for that, called
apt-file
, which needs to be installed in addition toapt-get
. You can use it this way:Note that
apt-file
uses special files on the package repository called Contents files. While all official repositories have these files, some third-party repositories might not have them, soapt-file
won't be able to list the contents of packages on these repositories.will also list other nice things you can do with
apt-file
, such asapt-file search <keyword>
which lets you find which packages provide a given file.There is no equivalent.
apt-get
is a layer on top ofdpkg
, not a replacement of it.apt-cache
can be used for some stuff you might want to do:Actually listing all packages:
To actually list all packages that is in
apt-get
's cache, useapt-cache pkgnames
. This is very much the equivalent ofdpkg -l
forapt-get
, except it only shows package names, and not any other information thatdpkg
might show.NOTE: Using
apt-cache pkgnames
will generate incredibly much output, on my system it is as much as 39553 lines. To see in advance how many lines it would be on your system, try usingapt-cache stats
(see below).Searching:
Use
apt-cache search <regex> [<regex> [...]]
where<regex>
is one or more regular expressions to search for.Counting:
Use
apt-cache stats
to show some statistics about that cache since lastapt-get update
.For instance, an example output might be:
It doesn't exist. You can use the GUI synaptic which will show you all the installed packages.
Shown below.