2012
03.15

Here’s a little snippet that I use to remove all the unused kernels on my Ubuntu servers/desktops. Unused means all the kernel that are currently not in use. For servers that don’t reboot so often that could mean removing kernels that are newer than uname -r. So make sure to pay attention…

dpkg -l | egrep '^ii  linux-(image|headers)-2' | awk '{print $2}' \
  | grep -v $(uname -r | sed 's/-generic//' | sed 's/-server//') \
  | xargs apt-get remove --purge -y \
;

2 comments so far

Add Your Comment
  1. I do not understand your instructions.

  2. What don’t you understand?