Ubuntu's kernel is often upgraded, and the old kernel does not automatically unload. Long time, there is a lot of kernel garbage, we need to manually clean up.
- First use Uname-a to view the current kernel version:
uname -alinux xzc3.13. 0--generic #2of all: £x86_64 x86_64 x86_64 Gnu/linux
Visible current version is 3.13.0-46
- Look at the kernel version of the current system installation with Dpkg--get-selections|grep Linux:
[Email protected]:~$ dpkg--get-selections|grepLinuxlibselinux1:amd64InstallLinux-firmwareInstallLinux-genericInstallLinux-headers-3.13.0- $ InstallLinux-headers-3.13.0- $-genericInstallLinux-headers-genericInstallLinux-image-3.13.0- $-genericInstallLinux-image-extra-3.13.0- --Generic Deinstalllinux-image-extra-3.13.0- $-genericInstallLinux-image-genericInstallLinux-libc-dev:amd64InstallLinux-signed-genericInstallLinux-signed-image-3.13.0- --Generic Deinstalllinux-signed-image-3.13.0- $-genericInstallLinux-signed-image-genericInstallLinux-sound-baseInstallPPTP-linuxInstallSyslinuxInstallSyslinux-commonInstallSyslinux-legacyInstallutil-linuxInstall
Where Linux-headers, linux-image, and linux-signed begin with kernel-related. With a version number, such as linux-image-extra-3.13. 0-44-generic) is deleted. Be careful not to delete the version you are currently using. The following install indicates that the installation has been installed, and the deinstall indicates that it has been installed and is now deleted (no space is occupied).
- sudo apt-get purge to remove
sudo apt-get purge linux-image-extra-3.13. 0-44-generic
< Span style= "color: #800080;" >sudo Apt-get purge Linux-signed-image-3.13. 0-44-generic
sudo Apt-get purge linux-headers-3.13. 0-44 (This seems to automatically put linux-headers-3.13.46-generic Delete, if not deleted, < Span style= "color: #800080;" >sudo Apt-get Purge linux-headers-3.13. 0-46-generic )
Be careful not to use the sudo apt-get remove to remove, linux-signed-image-3.13 will appear. 0-44-generic deinstall. Of course, it is also possible to delete the purge when running again.
- Update the boot menu with sudo update-grub
A netizen uses regular expression to write a script, did not try the script effect how:
' linux-* ' sed ' /^ii/!d;/ ' " "s/\ (. *\)-\ ([^0-9]\+\)/\1/")"' /d;s/^[^]* [^]* \ ([^]*\). */\1/;/[0-9]/!d'xargssudo apt-get-y Purge
Delete old Ubuntu kernel