Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The Ubuntu software center is able to display a detailed history of packages installed /updated/removed according to date.

  1. Where does it get this info from? (/var/log/dpkg.log is maintained only for 12 months; I don't know of any apt-* or dpkg commands to get the date when a package was first installed.)
  2. How can I copy this data in the form of a table / text to be processed by another program?
share|improve this question
You could try looking through /var/log/apt/history.log or the archived .gzs in the same folder, but I doubt it would go back 12 months back too. A year is a long time to keep logs. – mikewhatever Sep 24 '13 at 11:34

All history of packages installed/updated/removed is in /var/log/apt: new history in history.log file, old history in archives, in history.log.x.gz files. See the image below to get this data in a form of a table in Ubuntu Software Center:

USC - history

share|improve this answer
the data in this table cannot be copied/exported :/. In /var/log/apt/history.log the logs go back only 12 months. However the USC shows records from well before that. – staticd Sep 24 '13 at 14:59
@staticd I don't see any good/useful reason to copy/export this history. All history is in /var/log/apt: new history in history.log, old history in archives, in history.log.x.gz files. – Radu Rădeanu Sep 24 '13 at 15:35
old archives go back only 12 months. – staticd Sep 24 '13 at 16:40
@staticd I just opened history.log.5.gz/history.log.5 file and the first line from there is: Start-Date: 2012-10-17 14:57:48. So, you have no right. – Radu Rădeanu Sep 24 '13 at 16:59
up vote 1 down vote accepted

Thought the specifics are fairly useless, Unless you want to find out exactly what changes were made to the system on a specific day and time, I felt the steps I went through to discover this information were worth documenting:

I ran strace -e trace=open -f -o usc software-center to get a list of all the files opened by the software center. Then I filtered it like this.

cat usc| grep -oP '(?<=open\(").*(?=",)' |egrep -v '\.(so\.([0-9]|cache)|so|pyc|mo|py|png|svg)$'|egrep -v '/usr/lib/(python2.7|x86|girepo)'| egrep -v '/usr/share/(icons|themes)' |egrep -v '/etc/fonts'|egrep -v '(screenshots|reviews)\.ubuntu\.com' |egrep -v fontconfig |sort -u

to eliminate all the files didn't contain data files.

Among these I found the interesting looking looking file: ~/.cache/software-center/apthistory.p It looked like a python pickle file when I opened it. trying to load the file I got the error that softwarecenter.db.history_impl.apthistory was not imported. I ran the following command to look for python files that ere opened and had "softwarecenter" in their path

$cat usc| grep -oP '(?<=open\(").*(?=",)' |grep softwarecenter

and got a whole bunch of filenames including /usr/share/software-center/softwarecenter/db/history_impl/ I wrote the following script to read and process file:

import sys
import os
import pickle

import softwarecenter.db.history_impl.apthistory

with open(os.path.expanduser('~/.cache/software-center/apthistory.p')) as IFile:

print type(hist[0])
print "earliest apt transaction started on:",hist[-1].start_date
print "installed:"
for PackageStr in hist[-1].install:
    print PackageStr
print "upgraded:"
for PackageStr in hist[-1].upgrade:
    print PackageStr

I found the necessary attributes by looking up the class of which hist[0] was an instance of: help(softwarecenter.db.history_impl.apthistory.AptTransaction). This lead me to the parent class help( softwarecenter.db.history.Transaction) from where I figured out how to use it.

Btw even sudo apt-get installed stuff appears here.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.