Cleaning old kernels in Ubuntu
by bram
The safe way:
sudo aptitude -F ‘%p’ search linux-{image,headers,restricted}-2.6~i | grep -v `uname -r | sed -r ‘s/-[a-z0-9A-Z]+$//’
or, if you’re feeling lucky:
sudo aptitude -F ‘%p’ search linux-{image,headers,restricted}-2.6~i | grep -v `uname -r | sed -r ‘s/-[a-z0-9A-Z]+$//’` | xargs sudo aptitude purge -y