Hey Readers!

Today I have a bit of an update from the code I pasted last time. I added it to a script with some output that separates the different areas, making it easier to get the update done with a single command. It could be tweaked for automation by making the last apt command install blindly, but I prefer it not doing that so I can veto any updates if there's any reported issues.

#!/bin/bash
apt-get update
printf "\n\n\n============Updates Table=========\n\n\n"
apt-get --just-print upgrade 2>&1 | perl -ne 'if (/Inst\s([\w,\-,\d,\.,~,:,\+]+)\s\[([\w,\-,\d,\.,~,:,\+]+)\]\s\(([\w,\-,\d,\.,~,:,\+]+)\)? /i) {print "PROGRAM: $1 INSTALLED: $2 AVAILABLE: $3\n"}' | column -s " " -t
printf "\n\n\n============apt-get output=========\n\n\n"
apt-get upgrade

I save this as "pretty_apt.sh", and it's been very useful this past couple of weeks. Hope this can help someone!

If you have any recommendations or adjustments, feel free to share in the comments below!

Next Post Previous Post