How to list installed package and its details on ubuntu?

Simple and elegant:

sudo dpkg -l | more

or

sudo dpkg -l | less

If you want to get the description of some specific packages say firefox:

sudo dpkg -l | grep firefox

Here is my output of:

$ sudo dpkg -l | more
 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                                 Description
+++-===========================================-=======================================-==============================================================
================
ii  accountsservice                             0.6.15-2ubuntu9.4                       query and manipulate user account information
ii  acl                                         2.2.51-5ubuntu1                         Access control list utilities
ii  acpi-support                                0.140                                   scripts for handling many ACPI events
ii  acpid                                       1:2.0.10-1ubuntu3                       Advanced Configuration and Power Interface event daemon
ii  activity-log-manager-common                 0.9.4-0ubuntu3.2                        blacklist configuration for Zeitgeist (assets)
ii  activity-log-manager-control-center         0.9.4-0ubuntu3.2                        blacklist configuration for Zeitgeist (control center integrat
ion)
ii  adduser                                     3.113ubuntu2                            add and remove users and groups
ii  adium-theme-ubuntu                          0.3.2-0ubuntu1                          Adium message style for Ubuntu
ii  aisleriot                                   1:3.2.3.2-0ubuntu1                      Solitaire card games
ii  akonadi-backend-mysql                       1.7.2-0ubuntu1                          MySQL storage backend for Akonadi
ii  akonadi-server                              1.7.2-0ubuntu1                          Akonadi PIM storage service
ii  alacarte                                    0.13.2-2ubuntu4                         easy GNOME menu editing tool
ii  alsa-base                                   1.0.25+dfsg-0ubuntu1                    ALSA driver configuration files
ii  alsa-utils                                  1.0.25-1ubuntu5                         Utilities for configuring and using ALSA
ii  anacron                                     2.3-14ubuntu1                           cron-like program that doesn't go by time
ii  apg                                         2.2.3.dfsg.1-2                          Automated Password Generator - Standalone version
ii  app-install-data                            0.12.04.4                               Ubuntu applications (data files)
ii  app-install-data-partner                    12.12.04.1                              Application Installer (data files for partner applications/rep
ositories)
ii  apparmor                                    2.7.102-0ubuntu3.7                      User-space parser utility for AppArmor
ii  appmenu-gtk                                 0.3.92-0ubuntu1.1                       Export GTK menus over DBus
ii  appmenu-gtk3                                0.3.92-0ubuntu1.1                       Export GTK menus over DBus
ii  appmenu-qt                                  0.2.6-0ubuntu1                          appmenu support for Qt
ii  apport                                      2.0.1-0ubuntu17.1                       automatically generate crash reports for debugging
ii  apport-gtk                                  2.0.1-0ubuntu17.1                       GTK+ frontend for the apport crash report system
ii  apport-symptoms                             0.16.1                                  symptom scripts for apport
ii  apt                                         0.8.16~exp12ubuntu10.7                  commandline package manager
ii  apt-transport-https                         0.8.16~exp12ubuntu10.7                  https download transport for APT
ii  apt-utils                                   0.8.16~exp12ubuntu10.7                  package managment related utility programs
--More--

To get the date and time of packages being installed

cat /var/log/dpkg.log | grep " install "

To get for specific package:

$cat /var/log/dpkg.log | grep " install " | grep banshee
2013-12-12 12:51:48 install banshee <none> 2.4.1-3ubuntu1~precise2
2013-12-12 12:51:51 install banshee-extensions-common <none> 2.4.0-1ubuntu1
2013-12-12 12:51:51 install banshee-extension-radiostationfetcher <none> 2.4.0-    1ubuntu1
2013-12-12 12:51:51 install banshee-extension-soundmenu <none> 2.4.1-3ubuntu1~precise2

To get the section

$apt-cache show firefox | grep Section
Section: web

See Also: ListInstalledPackagesByDate


apt-cache showpkg <package> will give you details about what package versions are available, forward and reverse dependencies etc.

apt-cache show <package> will provide description, category (Section) etc.

I'm not aware of a way to see at what time a package was installed.


Now it is far easier to get the installation details of packages.

Here are the simple steps:

  1. Copy and paste following script in a file and save it with any name say pkgdetails.

    #!/bin/bash
    
    #Get the details and section of installed packages
    # usage:
    # pkgdetails <pkgname1> <pkgname2>
    
    #first append all info from archived logs
    
    i=2
    mycount=$(ls -l /var/log/dpkg.log.*.gz | wc -l)
    nlogs=$(( $mycount + 1 ))
    
    while [ $i -le $nlogs ]
    do
    if [ -e /var/log/dpkg.log.$i.gz ]; then
    zcat /var/log/dpkg.log.$i.gz | grep "\ install\ " >> $HOME/pkgtmp.txt
    fi
    i=$(( $i+1 ))
    
    done
    
    #next append all info from unarchived logs
    
    i=1
    nulogs=$(ls -l /var/log/dpkg.log.* | wc -l)
    nulogs=$(( $nulogs - $nlogs + 1 ))
    while [ $i -le $nulogs ]
    do
    if [ -e /var/log/dpkg.log.$i ]; then
    cat /var/log/dpkg.log.$i | grep "\ install\ " >> $HOME/pkgtmp.txt
    fi
    i=$(( $i+1 ))
    
    done
    
    #next append current log
    
    cat /var/log/dpkg.log | grep "\ install\ " >> $HOME/pkgtmp.txt
    
    #sort text file by date
    
    sort -n $HOME/pkgtmp.txt > $HOME/pkginstalls.txt
    
    rm $HOME/pkgtmp.txt
    
    # Now displaying the installation details of packages passed as arguments
    
    for pkg in $@
    do
    echo "--------------------- Installation Details of $pkg ----------------------"
    echo 
    cat $HOME/pkginstalls.txt | grep -i $pkg
    echo
    apt-cache show $pkg | grep "Section" | sort -u
    echo
    done
    
    exit 0
    
  2. Make the file executable and copy to /bin to use it as a command.

    chmod a+x pkgdetails && sudo cp pkgdetails /bin/
    
  3. Now use pkgdetails command to get the installation details and section of packages:

    pkgdetails qbittorrent artha
    

Here is my output:

--------------------- Installation Details of qbittorrent ----------------------

2013-07-24 07:52:27 install qbittorrent <none> 2.9.7-1
2013-07-24 09:11:32 install qbittorrent <none> 3.0.x-0~4366-20130722~precise1
2013-10-19 05:32:27 install qbittorrent <none> 3.0.x-0~4389-20130802~precise1

Section: net
Section: universe/net

--------------------- Installation Details of artha ----------------------

2013-07-11 23:50:16 install artha <none> 1.0.2-1ubuntu1

Section: universe/utils

Tags:

Dpkg

Apt