删除ubuntu旧内核的方法

接着上次 磁盘满了 需要清理系统盘

1,先用uname -a 查看当前内核版本:

   uname -a

  Linux 10-9-37-135 3.13.0-110-generic #157-Ubuntu SMP Mon Feb 20 11:54:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

 版本是3.13.0-110

2,看一下当前系统安装的内核版本:

    dpkg --get-selections|grep linux

    libselinux1:amd64                               install                                                      
    linux-firmware                                  install                                                      
    linux-generic                                   install                                                      
    linux-headers-3.13.0-100                        install                                                      
    linux-headers-3.13.0-100-generic                install                                                      
    linux-headers-3.13.0-101                        install                                                      
    linux-headers-3.13.0-101-generic                install                                                      
    linux-headers-3.13.0-103                        install                                                      
    linux-headers-3.13.0-103-generic                install                                                      
    linux-headers-3.13.0-105                        install                                                      
    linux-headers-3.13.0-105-generic                install                                                      
    linux-headers-3.13.0-106                        install                                                      
    linux-headers-3.13.0-106-generic                install                                                      
    linux-headers-3.13.0-107                        install                                                      
    linux-headers-3.13.0-107-generic                install                                                      
    linux-headers-3.13.0-108                        install                                                      
    linux-headers-3.13.0-108-generic                install                                                      
    linux-headers-3.13.0-109                        install                                                      
    linux-headers-3.13.0-109-generic                install                                                      
    linux-headers-3.13.0-110                        install                                                      
    linux-headers-3.13.0-110-generic                install                                                      
    linux-headers-3.13.0-63                         install                                                      
    linux-headers-3.13.0-63-generic                 install                                                      
    linux-headers-3.13.0-68                         install                                                      
    linux-headers-3.13.0-68-generic                 install                                                      
    linux-headers-3.13.0-71                         install                                                      
    linux-headers-3.13.0-71-generic                 install                                                      
    linux-headers-3.13.0-74                         install                                                      
    linux-headers-3.13.0-74-generic                 install                                                      
    linux-headers-3.13.0-76                         install                                                      
    linux-headers-3.13.0-76-generic                 install                                                      
    linux-headers-3.13.0-77                         install                                                                                  
    linux-image-3.13.0-100-generic                  install                                                      
    linux-image-3.13.0-101-generic                  install                                                      
    linux-image-3.13.0-103-generic                  install                                                      
    linux-image-3.13.0-105-generic                  install                                                      
    linux-image-3.13.0-106-generic                  install                                                      
    linux-image-3.13.0-107-generic                  install                                                      
    linux-image-3.13.0-108-generic                  install                                                      
    linux-image-3.13.0-109-generic                  install                                                      
    linux-image-3.13.0-110-generic                  install                                                      
    linux-image-3.13.0-24-generic                   deinstall                                                    
    linux-image-3.13.0-63-generic                   install                                                      
    linux-image-3.13.0-68-generic                   install                                                      
    linux-image-3.13.0-71-generic                   install                                                      
    linux-image-3.13.0-74-generic                   install                                                      
    linux-image-3.13.0-76-generic                   install                                                      
    linux-image-3.13.0-77-generic                   install                                                                                                
    linux-image-extra-3.13.0-100-generic            install                                                      
    linux-image-extra-3.13.0-101-generic            install                                                      
    linux-image-extra-3.13.0-103-generic            install                                                      
    linux-image-extra-3.13.0-105-generic            install                                                      
    linux-image-extra-3.13.0-106-generic            install                                                      
    linux-image-extra-3.13.0-107-generic            install                                                      
    linux-image-extra-3.13.0-108-generic            install                                                      
    linux-image-extra-3.13.0-109-generic            install                                                      
    linux-image-extra-3.13.0-110-generic            install                                                      
    linux-image-extra-3.13.0-24-generic             deinstall                                                    
    linux-image-extra-3.13.0-63-generic             install                                                      
    linux-image-extra-3.13.0-68-generic             install                                                      
    linux-image-extra-3.13.0-71-generic             install                                                      
    linux-image-extra-3.13.0-74-generic             install                                                      
    linux-image-extra-3.13.0-76-generic             install                                                      
    linux-image-extra-3.13.0-77-generic             install                                                                                               
    linux-image-generic                             install                                                      
    linux-libc-dev:amd64                            install                                                      
    pptp-linux                                      install                                                      
    util-linux                                      install

太惊人了 竟然这么多 主要是年头长,然后把不需要的都删除就行

3,删除多余的内核

上面linux-headers、linux-image、linux-signed开头的都是跟内核相关的.带有版本号的(如linux-image-extra-3.13.0-63-generic)才是可以删除的.注意不要删除当前使用的版本.

sudo apt-get purge来删除

sudo apt-get purge linux-image-extra-3.13.0-63-generic
sudo apt-get purge linux-signed-image-3.13.0-63-generic
sudo apt-get purge linux-headers-3.13.0-63(这个会自动把linux-headers-3.13.0-63-generic删除)

注意

不要使用sudo apt-get remove来删除,会出现linux-signed-image-3.13.0-63-generic deinstall

4,使用sudo update-grub更新启动菜单

小结

内核占用系统盘内存比较大 /usr/src 虽然只有2.5G 但是实际清理完会有7个多G

你可能感兴趣的:(删除ubuntu旧内核的方法)