Remove older kernel versions
These were taken from this source. My one-liner to remove old kernels (this also frees up disk space) dpkg --list | grep linux-image | awk '{ print $2 }' | sort -V | sed -n '/'`uname -r`'/q;p' | xargs sudo apt-get -y purge Explanation (remember, | uses the output of the previous command as the input to the next) dpkg –list lists all installed packages grep linux-image looks for the installed linux images awk '{ print $2 }' just outputs the 2nd column (which is the package name) sort -V puts the items in order by version number sed -n '/'`uname -r`'/q;p prints the lines before the current kernel xargs sudo apt-get -y purge purges the found kernels Unwinding the sed invocation: ...