Removing unused Ubuntu Linux Kernels.

When we install updates on Ubuntu Linux, the system gives a message free up kernel space message. Usually as updates are regularly downloaded & installed, the old versions exist, with their new counterparts. The old updates can be purged by issuing the following command.

The command cleans up all unused kernels on Ubuntu Linux.

$ > dpkg -l ‘linux-*’ | sed ‘/^ii/!d;/’$(uname -r | sed “s/\(.*\)-\([^0-9]\+\)/\1/”)‘/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d’ | xargs sudo apt-get -y purge