Remove Old Kernels in Ubuntu

The kernel version currently running:
uname -r

Find and remove old kernels:
ls /boot | grep vmlinuz | cut -d’-‘ -f2,3

The resulting list should something like this:

  • 2.6.32-17
  • 2.6.28-15

For example to remove the old kernel 2.6.32:
dpkg -l | grep ^ii | grep 2.6.28-15 | awk -F’ ‘ ‘{ print $2 }’

The resulting list should something like this:

  • linux-headers-2.6.28-15
  • linux-headers-2.6.28-15-generic
  • linux-image-2.6.28-15-generic
  • linux-restricted-modules-2.6.28-15-generic

and now remove them with dpkg, apt-get or aptitude

sudo aptitude remove linux-headers-2.6.28-15 linux-headers-2.6.28-15-generic linux-image-2.6.28-15-generic linux-restricted-modules-2.6.28-15-generic

Leave a Reply

Your email address will not be published. Required fields are marked *

*