Hi all,
how can I find out when I made the last d-u on my installation?
/var/log/apt/history.log
Hello,
you can have a script reading the log for you.
$ awk 'BEGIN {latest="not yet this month"} /dist-upgrade/ { latest=last" "$0;} { last=$0; } END { print latest }' /var/log/apt/history.log
Start-Date: 2015-10-05 23:46:46 Commandline: apt dist-upgrade
$ perl -wlne 'BEGIN {$latest="not yet this month"} /dist-upgrade/ and $latest="$last $_"; $last=$_; END { print $latest }' /var/log/apt/history.log
Start-Date: 2015-10-05 23:46:46 Commandline: apt dist-upgrade
That perl example seems to imitate the awk style. I'm sure there are other solutions, that are more "perlish".
greetings
musca
Uh, those look very awkish and perlish for my simple mind ;) . I generate a bit more output with grep 'dist-upgrade' /var/log/apt/history.log -a1 If too much, could be followed by |tail -2 ).
agreed, you don't need awk or perl when you have bash.
$ (latest="not yet this month"; while read line; do [[ $line =~ dist-upgrade ]] && latest="$last $line"; last="$line "; done ; printf "$latest\n") </var/log/apt/history.log
Start-Date: 2015-10-05 23:46:46 Commandline: apt dist-upgrade
and you can do it with lua:
$ lua -e 'latest="not yet this month"; for line in io.lines() do if string.find(line,"dist%-upgrade") then latest=last.." "..line end last=line end io.write(latest.."\n")' </var/log/apt/history.log
Start-Date: 2015-10-05 23:46:46 Commandline: apt dist-upgrade
greetings
musca
Thanks for your hinter, I will try all of them!