debsums
on all the packages. I used dpigs
and perl
to achieve this, being reasonably comfortable with the latter:
dpigs -n 300 | perl -ne 'BEGIN {$total = 0} /(\d+)/; $total += ($1 || 0) ; END { print "Total $total\n"}'
That worked, at least provided that there were less than 300 packages... I later thought about using awk
, which is precisely designed for this kind of applications. That actually looks like
dpigs -n 300 | awk '{a += $1} END {print a}'
Better already. But you still need to know the number of packages installed. Well, we could ask dpkg
, of course:
dpigs -n `dpkg -l | wc -l` | awk '{a += $1} END {print a}'
1 comment:
You can also use dpigs -n -1. Nice script, though!
Post a Comment