Wednesday, November 24, 2010

Get a List of Installed Software in Chronological Order

There is a single log file that records all the apt activities, such as installs or upgrades, for the various package managers (dpkg, apt-get, synaptic, aptitude). It can be found here : /var/log/dpkg.log.
If you want to have a more comprehensive history of the installed packages, you can use:
cat /var/log/dpkg.log* | grep "\ install\ " | sort
The result is a chronological list of package installation events. (Note that if a package was installed and subsequently removed, it will still be on the list.)

It turns out that there used to be an apt-history package, but the creator gave it up -due to the fact that dpkg now does logging- in favor of a small script solution: .
Below is the bash function from that web site.

function apt-history(){
case "$1" in
cat /var/log/dpkg.log | grep 'install '
cat /var/log/dpkg.log | grep $1
cat /var/log/dpkg.log | grep upgrade | \
grep "$2" -A10000000 | \
grep "$3" -B10000000 | \
awk '{print $4"="$5}'
cat /var/log/dpkg.log

The code should be added to /root/.bashrc.
To run apt-history, you need to become root. Entering apt-history with no parameter will simply dump the change log file. To select what activities you want to see, you can enter one of install, upgrade, remove, rollback as a single parameter to apt-history.

Another way to quickly extract informations from apt logs (term.log) is apt-log .
Some examples that would help understanding the common usage of apt-log :

Edit : another way to list your installed packages is

No comments:

Post a Comment