日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 综合教程 >内容正文

综合教程

Ubuntu删除多余内核

發(fā)布時間:2023/11/21 综合教程 60 生活家
生活随笔 收集整理的這篇文章主要介紹了 Ubuntu删除多余内核 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

第一步:查看當(dāng)前內(nèi)核

rew $ uname -a
Linux rew 4.15.0-42-generic #45~16.04.1-Ubuntu SMP Mon Nov 19 13:02:27 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

當(dāng)前使用版本為:4.15.0-42-generic

第二步:查看所有內(nèi)核
dpkg --get-selections | grep linux

rew $ dpkg --get-selections | grep linux
console-setup-linux                     install
libselinux1:amd64                       install
libselinux1:i386                        install
linux-base                              install
linux-firmware                          install
linux-generic-hwe-16.04                 install
linux-headers-4.15.0-42                 install
linux-headers-4.15.0-39                 install
linux-headers-4.15.0-39-generic         install
linux-headers-4.15.0-42-generic         install
linux-headers-generic-hwe-16.04         install
linux-image-4.15.0-39-generic           install
linux-image-4.15.0-42-generic           install
linux-image-generic-hwe-16.04           install
linux-libc-dev:amd64                    install
linux-libc-dev:i386                     install
linux-modules-4.15.0-39-generic         install
linux-modules-4.15.0-42-generic         install
linux-modules-extra-4.15.0-39-generic   install
linux-modules-extra-4.15.0-42-generic   install
linux-sound-base                        install
pptp-linux                              install
syslinux                                install
syslinux-common                         install
syslinux-legacy                         install
util-linux                              install

第三步:移除冗余內(nèi)核

多余的內(nèi)核可以通過命令刪除 需要刪除header和image

sudo apt-get remove linux-image-*.*.*-**(*號用你想刪除的實際情況改寫)
sudo apt-get remove linux-headers-*.*.*-**(*號用你想刪除的實際情況改寫)
所有39版本的對我來說都是多余的,進行刪除:

rew $ sudo apt-get remove \
linux-headers-4.15.0-39 \
linux-headers-4.15.0-39-generic \
linux-image-4.15.0-39-generic \
linux-modules-4.15.0-39-generic \
linux-modules-extra-4.15.0-39-generic

卸載后重新檢查:
dpkg --get-selections | grep linux

rew $ dpkg --get-selections | grep linux
console-setup-linux                     install
libselinux1:amd64                       install
libselinux1:i386                        install
linux-base                              install
linux-firmware                          install
linux-generic-hwe-16.04                 install
linux-headers-4.15.0-42                 install
linux-headers-4.15.0-42-generic         install
linux-headers-generic-hwe-16.04         install
linux-image-4.15.0-39-generic           deinstall
linux-image-4.15.0-42-generic           install
linux-image-generic-hwe-16.04           install
linux-libc-dev:amd64                    install
linux-libc-dev:i386                     install
linux-modules-4.15.0-39-generic         deinstall
linux-modules-4.15.0-42-generic         install
linux-modules-extra-4.15.0-39-generic   deinstall
linux-modules-extra-4.15.0-42-generic   install
linux-sound-base                        install
pptp-linux                              install
syslinux                                install
syslinux-common                         install
syslinux-legacy                         install
util-linux                              install

狀態(tài)為deinstall即已經(jīng)卸載,如果覺得看著不舒服的話可以使用purge連配置文件里一起徹底刪除,清理內(nèi)核列表

rew $ sudo apt-get purge \
linux-headers-4.15.0-39 \
linux-headers-4.15.0-39-generic \
linux-image-4.15.0-39-generic \
linux-modules-4.15.0-39-generic \
linux-modules-extra-4.15.0-39-generic

第四步:更新系統(tǒng)引導(dǎo)
刪除內(nèi)核后需要更新grub移除失效的啟動項

rew $ sudo update-grub  #根據(jù)情況選擇grub/grub2
還有一種通過正則表達式匹配內(nèi)核然后除最新的統(tǒng)統(tǒng)統(tǒng)統(tǒng)刪除的。
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/-/\1/")"'/d;s/^[^ ]* [^ ]*?.*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge

作者:hwrenx
鏈接:https://www.jianshu.com/p/f284bc90944f

總結(jié)

以上是生活随笔為你收集整理的Ubuntu删除多余内核的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。