Monday, January 10, 2011

What's apt-get's equivalent option of this dpkg command?

dpkg -L <package>

This command gives me a list of all the installed files, what's apt-get's equivalent option for it? I read the man page but couldn't figure out.

From ubuntu grokus
  • There is no equivalent. apt-get is a layer on top of dpkg, not a replacement of it.

  • It doesn't exist. You can use the GUI synaptic which will show you all the installed packages.

    Shown below.

    alt text

  • 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.

    From Raphink
  • 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
    
    From Frxstrem

0 comments:

Post a Comment