Created
December 18, 2024 10:46
-
-
Save zdk/0e6bfc33fb30e66af12d7fbefc0075e9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} | |
# apt-get -s install $(apt-history rollback | tr '\n' ' ') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment