Ubuntu – Get the list of installed packages with install time, date and vendor details with dpkg-query command

dpkgpackage-management

I am trying to get package name with version, splitted package and version, vendor of that package, install time and date using:

dpkg-query -W -f='${Package}-${version} ${package} ${version} ${Maintainer} ${installtime}\n'

But I got package name with version, splitted package and version, vendor of that package. I was not able to retrieve install time and date.

How can I get package install time and date with the above query?

Best Answer

  • dpkg-query does not have any field option to show date/time of installation. The other way of saying this is that dpkg does not store this information. Under the hood, dpkg-query uses various files in /var/lib/dpkg/ to get the information.

    Here are the available field names:

    Architecture
    Bugs
    Conffiles (internal)
    Config-Version (internal)
    Conflicts
    Breaks
    Depends
    Description
    Enhances
    Essential
    Filename (internal, front-end related)
    Homepage
    Installed-Size
    MD5sum (internal, front-end related)
    MSDOS-Filename (internal, front-end related)
    Maintainer
    Origin
    Package
    Pre-Depends
    Priority
    Provides
    Recommends
    Replaces
    Revision (obsolete)
    Section
    Size (internal, front-end related)
    Source
    Status (internal)
    Suggests
    Tag (usually not in .deb but in repository Packages files)
    Triggers-Awaited (internal)
    Triggers-Pending (internal)
    Version
    

    And some virtual fields too:

    binary:Package
    binary:Summary
    db:Status-Abbrev
    source:Package
    source:Version
    

    Check man dpkg-query to get a broader idea.


    Note that, you can look at /var/log/dpkg.log* for the installation date/time of packages. Also note that, if your package is installed by apt-get (or brothers), you can look at the apt history files, /var/log/apt/history.log*, too.

  • Related Question