dpkg --get-selections | grep linux-imagedpkg --get-selections | grep linux-image1、查看当前内核
方法一:sudo cat /proc/version
方法二:sudo uname -a
$ sudo cat /proc/version
Linux version 5.15.0-50-generic (buildd@lcy02-amd64-009) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #56~20.04.1-Ubuntu SMP Tue Sep 27 15:51:29 UTC 2022
$ sudo uname -a
Linux r********* 5.15.0-50-generic #56~20.04.1-Ubuntu SMP Tue Sep 27 15:51:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
$ sudo uname -r
5.15.0-50-generic
内核版本5.15.0-50-generic
2、查看可用内核
方法一:dpkg --get-selections | grep linux-image
方法二:grep menuentry /boot/grub/grub.cfg
$ sudo dpkg --get-selections |grep linux-image
linux-image-5.15.0-46-generic deinstall
linux-image-5.15.0-50-generic install
linux-image-5.15.0-52-generic install
linux-image-generic-hwe-20.04 install
$ grep menuentry /boot/grub/grub.cfg
if [ x"${feature_menuentry_id}" = xy ]; thenmenuentry_id_option="--id"menuentry_id_option=""
export menuentry_id_option
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-4964b50b-bc7b-420a-8c0a-50e0030d45ad' {
submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-4964b50b-bc7b-420a-8c0a-50e0030d45ad' {menuentry 'Ubuntu, with Linux 5.15.0-52-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.15.0-52-generic-advanced-4964b50b-bc7b-420a-8c0a-50e0030d45ad' {menuentry 'Ubuntu, with Linux 5.15.0-52-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.15.0-52-generic-recovery-4964b50b-bc7b-420a-8c0a-50e0030d45ad' {menuentry 'Ubuntu, with Linux 5.15.0-50-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.15.0-50-generic-advanced-4964b50b-bc7b-420a-8c0a-50e0030d45ad' {menuentry 'Ubuntu, with Linux 5.15.0-50-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.15.0-50-generic-recovery-4964b50b-bc7b-420a-8c0a-50e0030d45ad' {
menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' {