Skip to content

Instantly share code, notes, and snippets.

@neuni
Last active August 29, 2015 14:19
Show Gist options
  • Save neuni/c8e32b58f2d231feb3ea to your computer and use it in GitHub Desktop.
Save neuni/c8e32b58f2d231feb3ea to your computer and use it in GitHub Desktop.
Clean /boot by removing old kernel packages

First check your current version.

uname -a

Then run the following command:

dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d'

This command will list all packages that you no longer need. So for every package listed do the following:

sudo apt-get -y purge some-kernel-package
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment