Remove unused Linux kernel related packages

There is a very simple command:

dpkg -l 'linux-<em>' | sed '/^ii/!d;/'&quot;$(uname -r | sed &quot;s/&#40;.</em>&#41;-&#40;[^0-9]&#43;&#41;/\1/&quot;)&quot;'/d;s/^[^ ]* [^ ]* &#40;[^ ]<em>&#41;.</em>/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge

From “Ubuntu Cleanup: How to Remove All Unused Linux Kernel Headers, Images and Modules

%d bloggers like this: