Skip to content

Instantly share code, notes, and snippets.

@bitaxis
Created August 20, 2020 01:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bitaxis/b3f021fcdf73de701c1c1696f2ffdd64 to your computer and use it in GitHub Desktop.
Save bitaxis/b3f021fcdf73de701c1c1696f2ffdd64 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
echo '-----> update <-----'
apt update
echo '-----> upgrade <-----'
apt --yes upgrade
echo '-----> dist-upgrade <-----'
apt --yes dist-upgrade
echo '-----> autoremove <-----'
apt --yes autoremove
echo '-----> autoclean <-----'
apt autoclean
# dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt -y purge
# http://chr4.org/blog/2013/08/04/apt-cleanup-commands/
echo '-----> purge <-----'
apt --yes purge $(dpkg --list |egrep 'linux-image-[0-9]' |awk '{print $3,$2}' |sort -nr |tail -n +2 |grep -v $(uname -r) |awk '{ print $2}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment