1、CentOS卸载Linux旧内核
使用root登录
用下面的命令查找一下,旧的内核包
rpm -qa |grep kernel
然后把以前的内核包删掉
我们删除的是内核包,所以要用rpm 这个命令
[yuan@yuan ~]$ rpm -qa |grep kernel
kernel-devel-2.6.27.19-170.2.35.fc10.i686
kernel-2.6.27.5-117.fc10.i686
kerneloops-0.12-1.fc10.i386
kernel-firmware-2.6.27.19-170.2.35.fc10.noarch
kernel-headers-2.6.27.19-170.2.35.fc10.i386
kernel-2.6.27.19-170.2.35.fc10.i686
kernel-2.6.27.15-170.2.24.fc10.i686
kernel-devel-2.6.27.15-170.2.24.fc10.i686
然后卸载你需要卸载的内核版本
rpm -e [你需要卸载的内核版本号,去掉外面的中括号]
2、Ubuntu卸载旧内核
使用Ubuntu一段时间后,就会发觉由于自动升级,系统里安装了很多内核。可以删掉一些不用的,节省硬盘空间。
首先就是使用如下命令,列出所有安装的内核,下表中,带有p_w_picpath的就是内核文件。从中选择要卸载的包,用apt-get来卸载
[yuan@ubuntu:~]$ dpkg --get-selections|grep linux
libselinux1 install
linux-386 install
linux-p_w_picpath-2.6.15-23-386 install
linux-p_w_picpath-2.6.15-27-386 install
linux-p_w_picpath-2.6.15-27-686 install
linux-p_w_picpath-2.6.15-28-386 install
linux-p_w_picpath-2.6.15-28-686 deinstall
linux-p_w_picpath-386 install
linux-kernel-headers install
linux-restricted-modules-2.6.15-23-386 install
linux-restricted-modules-2.6.15-27-386 install
linux-restricted-modules-2.6.15-27-686 install
linux-restricted-modules-2.6.15-28-386 install
linux-restricted-modules-2.6.15-28-686 deinstall
linux-restricted-modules-386 install
linux-restricted-modules-common install
linux-sound-base install
util-linux install
具体的卸载方法为
sudo apt-get remove linux-p_w_picpath-2.6.15-23-386
这样就可以实现自动删除内核文件了,还可以释放磁盘空间。
另外还要记录一个命令。
uname -a
使用这个命令可以查看当前系统使用的内核
转载于:https://blog.51cto.com/yuanxiaojun/982196