#使用cat /boot/grub2/grub.cfg |grep menuentry 查看系统可用内核
root@Cs7-sh-:/root> cat /boot/grub2/grub.cfg |grep menuentry
if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
menuentry_id_option=""
export menuentry_id_option
menuentry 'CentOS Linux (3.10.0-693.2.2.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-514.21.1.el7.x86_64-advanced-58ebcc18-06a4-454a-a772-4f583085b996' {
menuentry 'CentOS Linux (3.10.0-514.21.1.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-514.21.1.el7.x86_64-advanced-58ebcc18-06a4-454a-a772-4f583085b996' {
menuentry 'CentOS Linux (3.10.0-514.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-514.el7.x86_64-advanced-58ebcc18-06a4-454a-a772-4f583085b996' {
menuentry 'CentOS Linux (0-rescue-8d13a50988cc5c4972347415eddf7d47) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-8d13a50988cc5c4972347415eddf7d47-advanced-58ebcc18-06a4-454a-a772-4f583085b996' {
#查看当前内核
root@Cs7-sh-:/root> uname -r
3.10.-514.21.1.el7.x86_64
#修改开机时默认使用的内核
grub2-set-default 'CentOS Linux (3.10.0-693.2.2.el7.x86_64) 7 (Core)'
#查看内核修改结果
root@Cs7-sh-03:/root> grub2-editenv list 17-10-10 14:21
saved_entry=CentOS Linux (3.10.0-693.2.2.el7.x86_64) 7 (Core)
#查看系统安装了哪些内核包
root@Cs7-sh-03:/root> rpm -qa |grep kernel
kernel-3.10.0-514.el7.x86_64
kernel-3.10.0-514.21.1.el7.x86_64
kernel-debug-devel-3.10.0-693.2.2.el7.x86_64
abrt-addon-kerneloops-2.1.11-48.el7.centos.x86_64
kernel-tools-libs-3.10.0-693.2.2.el7.x86_64
kernel-tools-3.10.0-693.2.2.el7.x86_64
kernel-headers-3.10.0-693.2.2.el7.x86_64
kernel-3.10.0-693.2.2.el7.x86_64
#使用yum remove 或rpm -e 删除无用内核
yum remove kernel-3.10.0-514.21.1.el7.x86_64
参考:http://www.cnblogs.com/niyeshiyoumo/p/6762193.html