Remove unused kernels in Ubuntu

Update @20:th Aug 2015

The old dpkg trick was unstable and wanted to delete tons of unwanted things more than 50% of the time, so I found another useful command which has a higher success rate of doing what we want.



aptitude purge ~ilinux-image-\[0-9\]\(\!`uname -r`\)


source: http://www.upubuntu.com/2011/11/how-to-remove-unused-old-kernels-on.html









Run the following command to see what the command will remove:


dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | xargs sudo apt-get --dry-run remove



And finally to actually remove the kernels use:



dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | xargs sudo apt-get -y purge



source: http://tuxtweaks.com/2010/10/remove-old-kernels-in-ubuntu-with-one-command/




Comments

Popular posts from this blog

waoo port forwarding broken

How to compile Percona XtraDB Cluster 5.6 on Ubuntu 14.04 Trusty Tahr

Building XtraBackup for Mac OSX