Skip to content

Instantly share code, notes, and snippets.

@tcbennun
Created November 8, 2021 09:49
Show Gist options
  • Save tcbennun/6625aa25e94bd540bff471409068f0c5 to your computer and use it in GitHub Desktop.
Save tcbennun/6625aa25e94bd540bff471409068f0c5 to your computer and use it in GitHub Desktop.
apt-history
function apt-history(){
case "$1" in
install)
cat /var/log/dpkg.log | grep 'install '
;;
upgrade|remove)
cat /var/log/dpkg.log | grep $1
;;
rollback)
cat /var/log/dpkg.log | grep upgrade | \
grep "$2" -A10000000 | \
grep "$3" -B10000000 | \
awk '{print $4"="$5}'
;;
*)
cat /var/log/dpkg.log
;;
esac
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment