203

Is there a place where I can look what updates I've installed?

0

7 Answers 7

211

You can read the history.log file in /var/log/apt.

Eg. less /var/log/apt/history.log.

4
  • 14
    Worth noting that there may be older history files in that folder, not just /var/log/apt/history.log. Maybe something like /var/log/apt/history.log.1.gz Nov 22, 2019 at 16:17
  • 3
    Still working even on Bionic. Just in case someone's afraid because of the response's age.
    – Alfabravo
    May 20, 2020 at 15:24
  • 6
    To read and filter rotated logs: zcat /var/log/apt/history.log.* | perl -00 -ne 'print if /\ninstall/i' (with -00 each paragraphs is a record) Jun 9, 2021 at 17:04
  • Terminal log /var/log/opt/term.log could also be useful if you need to figure out what happened during the installation.
    – Danijel
    Mar 7, 2022 at 8:26
48

In 10.10, Ubuntu Software Center has a list of all the updates you have downloaded in the past.

enter image description here

2
  • 4
    +1 This answer works on more recent versions too. Jul 26, 2014 at 19:05
  • 13
    @JamesBradbury This option is gone from Ubuntu 16.04 on
    – feeela
    Apr 3, 2018 at 11:00
29

/var/log/apt contains a history of package installations. However, by default, it is managed by logrotate which compresses and ages out old entries.

2
23

As an alternative to lgarzo's answer, you can grep what you are interested in from /var/log/dpkg.log. E.g., if you want to see everything you installed or upgraded yesterday, you could run:

cat /var/log/dpkg.log | grep "^2012-03-25.*\ installed\ "

One thing to note: this will also list manually installed packages (sudo dpkg -i ...), which won't show up in apt's history.

Even better use zgrep if it's installed so you can find lines in gzipped files as well

zgrep "^2012-03-25.*\ installed\ " /var/log/dpkg.log*
21

On 10.04 Click (System > Administration > Synaptic Package Manager > File > History)

1
  • 12
    All I get is a list of packages that I installed via Synaptic, it doesn't show all the packages I updated via Update Manager.
    – Isaiah
    Nov 21, 2010 at 19:39
11

It's now possible to do this through the software center as well! Go to History and you can display all of your updates and installations.

Software Center History

2
  • I suppose it is 10.10 ?
    – vrcmr
    Nov 21, 2010 at 19:36
  • Sure is. I don't think this was available in previous distributions... Nov 21, 2010 at 19:53
3

It became useful for us to have a slightly more easy and accurate answer to the question "when was the last time we patched this thing?". So I put this together. I tested it on 12.04 and 14.04 and 16.04. It returns reasonably accurate answers for that question. Note: "reasonably accurate" probably isn't "completely accurate". Note: "for that question" only.

sample output:

xenial% 9: ./linuxpatchdate 
2016-07-19 54
2017-02-24 363
2017-03-08 7
2017-03-09 2

subroutines and program:

#!/usr/bin/perl

#------------------ subroutines --------------------

sub parseRecord {
    my $sdate = "";
    my $useful = 0;
    my $packages = 0;
    my @ptmp;
    while (my $recordLine = shift() ) {

       if ($recordLine =~ m/^Start-Date: ([\d\-]*).*/) {
          $sdate = $1;
       }
       elsif ($recordLine =~ m/^Commandline:.*upgrade/) {
          $useful = 1;
       }
       elsif ($recordLine =~ m/^Install: (.*)/) {
          $recordLine =~ s/\([^\)]*\)//g;
          @ptmp = split(/,/,$recordLine);
          $packages = $packages + $#ptmp + 1;
       }
       elsif ($recordLine =~ m/^Upgrade: (.*)/) {
          $recordLine =~ s/\([^\)]*\)//g;
          @ptmp = split(/,/,$recordLine);
          $packages = $packages + $#ptmp + 1;
       }
    }



    if ($useful) {
       return ($sdate,$packages);
    }
    else {
       return ("0",0);
    }
}


#------------------ main program --------------------

@lines = split(/\n/,`/bin/zcat -f /var/log/apt/history.log  /var/log/apt/history*gz`);
my %patchHash;
my $line;
my @inputLines;
my $pushDate = "";
my $pushNum = "";

foreach $line (@lines) {
    # all records separated by blank lines
    if ($line !~ /./) {
       # no-op
    }
    elsif ($line =~ m/^Start-Date: ([\d\-]*).*/) {
       @inputLines = ();
       push (@inputLines, $line);
    }
    elsif ($line =~ m/^End-Date: ([\d\-]*).*/) {
       ($pushDate, $pushNum) = parseRecord(@inputLines);
       if ($pushNum != 0) {
          $patchHash{$pushDate} += $pushNum;
       }
    }
    else {
       push (@inputLines, $line);
    }
}

foreach $pushDate (sort(keys(%patchHash))) {
   print "$pushDate $patchHash{$pushDate}\n";
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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