Debian aptitude History

How can we get a history of aptitude activity in Debian Squeeze? It’s simple: check out the /var/log/dpkg.log file. According to How to show apt log history, there existed a tool called apt-history, but it doesn’t any more. It further recommends a bash function called apt-history, which can be installed on your machine. Since I love to chain commands together, and haven’t wrote a single bash file ever, I thought what would be interesting to write myself? Below are the results (all commands are on one line even though blog formatting may indicate otherwise):

Get a list of installed and upgraded packages, with the activity date:
grep -i -w '\(install\|upgrade\)' /var/log/dpkg.log | cut -d' ' -f1,3,4 | uniq | less

Get a list of unique activities performed by aptitude:
cut -d' ' -f3 /var/log/dpkg.log | sort | uniq | less

Get a list of packages handled by aptitude, and the number of times they were handled:
cut -d' ' -f4 /var/log/dpkg.log | sort | uniq -c | less

Above commands and “scripts” were just some ways to analyze the log file. I am sure you can find some other, more interesting things to do with the file. Please share them with us.

3 Responses to Debian aptitude History

  1. Pingback: Weapons Guru Football Texting ~ ThermionicEmissions

  2. Anonymous says:

    Very nice – thank!

  3. Anonymous says:

    Thx! I also did not knew the ‘uniq’ command!

%d bloggers like this: