I had to install a kernel update on my work laptop that is running Xubuntu, and it wouldn’t download because I had run out of space in /boot. That’s almost always caused from having too many kernel image files saved there from previous updates.
Well I found a really cool one-line command that removes all kernel images except the current one. That command is:

export KERNEL=”$(uname -r | grep -Po ‘([0-9.-]*[0-9])?’)”; dpkg –get-selections | grep -E “linux-(header|image).*” | grep -iw install | sort | grep -v “$KERNEL” | grep -v “lts” | sed ‘s/install//g’ | xargs dpkg -P

You can put that in a convenient script if you like for future use!

Categories: Linux

Leave a Reply

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

Related Posts


OpenFiler- The Best Manual Available



OpenFiler Graphical Installation Guide

Graphical Installation This How-to applies to: 2.2, 2.3 Installation of Openfiler using the standard graphical-based installation method. Introduction This document describes the process of installing Openfiler using the default graphical installation interface. If you experience Read more…


Openfiler Configuration for ESX using iSCSI

Openfiler is a Linux based small operating system that provides file-based network-attached storage and block-based storage area network and is free software. It can run with very minimal resource.Below I will show how we can take Read more…