Skip to content

Instantly share code, notes, and snippets.

@trisgelar
Created December 6, 2016 12:41
Show Gist options
  • Save trisgelar/b2ba58e693ca5a3e45dc47da4782b9e6 to your computer and use it in GitHub Desktop.
Save trisgelar/b2ba58e693ca5a3e45dc47da4782b9e6 to your computer and use it in GitHub Desktop.
### pars for fun: install | remove | rollback
function apt-history(){
case "$1" in
install)
grep 'install ' /var/log/dpkg.log
;;
upgrade|remove)
grep $1 /var/log/dpkg.log
;;
rollback)
grep upgrade /var/log/dpkg.log | \
grep "$2" -A10000000 | \
grep "$3" -B10000000 | \
awk '{print $4"="$5}'
;;
*)
cat /var/log/dpkg.log
;;
esac
}
#https://askubuntu.com/questions/21657/how-do-i-show-apt-get-package-management-history-via-command-line/337006
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment