如何從Commandline列出或檢查所有已安裝的Linux內核
Linux Kernel is the core component of a GNU/Linux operating system. Developed by Linus Torvalds in 1991, it is a free, open-source, monolithic, modular, and multitasking Unix-like kernel. In Linux, it is possible to install multiple kernels on a single system. Have you ever wondered how many Linux kernels are installed on your Linux box? In this tutorial, we will explore how to check and view all installed Linux kernels, including their versions, from the command line in different Linux operating systems.
Table of Contents
Check All Installed Linux Kernels
The method to identify all installed Linux kernel details in your system may vary depending on the Linux distribution you use. However, one of the easiest and quickest ways to accomplish this is by using the find command.
In most Linux distributions, the installed Linux kernels and their associated files are typically stored in the /boot directory. To view the list of installed kernels, you can simply examine the contents of this directory using the find command:
$ find /boot/vmli*
Sample Output from my Ubuntu 22.04 LTS desktop:
/boot/vmlinuz /boot/vmlinuz-5.19.0-42-generic /boot/vmlinuz-5.19.0-45-generic /boot/vmlinuz.old
You can also use the following command to list all installed Linux Kernels:
$ sudo find /boot -name "vmlinuz*"
The output will display a list of installed kernel files. Each file corresponds to a specific kernel version. Note that the prefix "vmlinuz" is commonly used for kernel filenames.
As you see in the above output, there are two Linux Kernels versions (5.19.0-42 and 5.19.0-45) are installed in my Ubuntu desktop machine.
To view the kernel version associated with each file, you can use the following command:
$ sudo find /boot -name "vmlinuz*" -exec file {} \;
Sample Output:
/boot/vmlinuz: symbolic link to vmlinuz-5.19.0-45-generic /boot/vmlinuz.old: symbolic link to vmlinuz-5.19.0-42-generic /boot/vmlinuz-5.19.0-42-generic: Linux kernel x86 boot executable bzImage, version 5.19.0-42-generic (buildd@lcy02-amd64-074) #43~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Apr 21 16:51:08 UTC 2, RO-rootFS, swap_dev 0XB, Normal VGA /boot/vmlinuz-5.19.0-45-generic: Linux kernel x86 boot executable bzImage, version 5.19.0-45-generic (buildd@lcy02-amd64-117) #46~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Jun 7 15:06:04 UTC 20, RO-rootFS, swap_dev 0XB, Normal VGA
Now we will see distribution-specific methods to find out installed Linux kernel details. First, let us start from Alpine Linux.
1. Check Installed Kernels in Alpine Linux
To obtain a list of all installed kernels along with their versions, you can use the following apk command in Alpine Linux:
$ apk info -vv | grep linux
Sample Output:
libblkid-2.32-r0 - Block device identification library from util-linux <strong>linux-virt-4.14.167-r0 - Linux vanilla kernel</strong> syslinux-6.04_pre1-r1 - Boot loader for the Linux operating system
2. List Installed Kernels in Arch Linux
To view all installed in Arch Linux and its variants like EndeavourOS and Manjaro Linux, run the following pacman command:
$ pacman -Q linux
Sample Output:
linux 5.9.14.arch1-1
You can also combine pacman and grep commands to list installed Kernel versions:
$ pacman -Q | grep linux
Sample Output:
archlinux-keyring 20201210-1 <strong>linux 5.9.14.arch1-1</strong> linux-api-headers 5.8-1 util-linux 2.36.1-4 util-linux-libs 2.36.1-4
As you can see, I have only one Linux Kernel in my Arch Linux system and its version is 5.9.14.
3. Find Installed Linux Kernels in Debian, Ubuntu, Linux Mint, Pop!_OS
In Debian and other Debian-based systems like Ubuntu, Pop!_OS, Linux Mint, we can find the list of all installed Kernels using dpkg command:
$ dpkg --list | grep linux-image
Sample Output:
ii linux-image-5.19.0-42-generic 5.19.0-42.43~22.04.1 amd64 Signed kernel image generic ii linux-image-5.19.0-45-generic 5.19.0-45.46~22.04.1 amd64 Signed kernel image generic ii linux-image-generic-hwe-22.04 5.19.0.45.46~22.04.20 amd64 Generic Linux kernel image
4. View installed Kernels in Fedora, CentOS, RHEL, AlmaLinux, Rocky Linux
To view all installed kernels in RPM-based systems like Fedora, CentOS, RHEL, and RHEL-clones such as AlmaLinux, you can use the rpm command as shown below:
$ rpm -qa kernel
Or,
$ rpm -qa | grep -i kernel
Sample Output from Fedora 33:
kernel-core-5.8.15-301.fc33.x86_64
Sample Output from AlmaLinux 8.3:
5. List All Installed Linux Kernels in openSUSE
The command to list all installed Linux kernels in openSUSE, being an RPM-based system like Fedora and RHEL distributions, is the same:
$ rpm -qa | grep -i kernel
Bonus tip - View only Current Kernel Details
To view the currently running Kernel, you can use one of the following commands:
$ uname -r 5.4.0-65-generic
Or,
$ uname -rs Linux 5.4.0-65-generic
Or,
$ uname -mrs Linux 5.4.0-65-generic x86_64
Now, you know the list of installed Kernels on your Linux system. How would you find when a specific Linux Kernel version is last booted? That's easy! Refer the following guide to check when a Linux kernel last used or booted on.
- Find When A Specific Linux Kernel Version Is Last Booted
Conclusion
In this guide, we have explored various methods to retrieve the list of installed kernels on different Linux distributions. Checking the installed Linux kernels on your system is essential for managing and maintaining a stable and up-to-date operating environment.
By being aware of the installed kernels and their versions, you can ensure that your system is up-to-date with the latest security patches and performance improvements.
Related Read:
- How To Remove Old Unused Linux Kernels
- Display Linux Kernel Module Information With Modinfo Command
- Find out the Linux distribution name, version and Kernel details
- How To Find Linux System Details Using inxi
- Neofetch – Display Linux system Information In Terminal
- Find Linux System Details Using Python
- How To Find Hardware And Software Specifications In Ubuntu
以上是如何從Commandline列出或檢查所有已安裝的Linux內核的詳細內容。更多資訊請關注PHP中文網其他相關文章!

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

Linux管理員的平均年薪在美國為75,000至95,000美元,歐洲為40,000至60,000歐元。提升薪資可以通過:1.持續學習新技術,如雲計算和容器技術;2.積累項目經驗並建立Portfolio;3.建立職業網絡,拓展人脈。

Linux系統管理員的主要任務包括系統監控與性能調優、用戶管理、軟件包管理、安全管理與備份、故障排查與解決、性能優化與最佳實踐。 1.使用top、htop等工具監控系統性能,並進行調優。 2.通過useradd等命令管理用戶賬戶和權限。 3.利用apt、yum管理軟件包,確保系統更新和安全。 4.配置防火牆、監控日誌、進行數據備份以確保系統安全。 5.通過日誌分析和工具使用進行故障排查和解決。 6.優化內核參數和應用配置,遵循最佳實踐提升系統性能和穩定性。

Linux和Windows在虛擬化支持上的主要區別在於:1)Linux提供KVM和Xen,性能和靈活性突出,適合高定制環境;2)Windows通過Hyper-V支持虛擬化,界面友好,與Microsoft生態系統緊密集成,適合依賴Microsoft軟件的企業。

Linux的主要用途包括:1.服務器操作系統,2.嵌入式系統,3.桌面操作系統,4.開發和測試環境。 Linux在這些領域表現出色,提供了穩定性、安全性和高效的開發工具。

學習Linux並不難。 1.Linux是一個開源操作系統,基於Unix,廣泛應用於服務器、嵌入式系統和個人電腦。 2.理解文件系統和權限管理是關鍵,文件系統是層次化的,權限包括讀、寫和執行。 3.包管理系統如apt和dnf使得軟件管理方便。 4.進程管理通過ps和top命令實現。 5.從基本命令如mkdir、cd、touch和nano開始學習,再嘗試高級用法如shell腳本和文本處理。 6.常見錯誤如權限問題可以通過sudo和chmod解決。 7.性能優化建議包括使用htop監控資源、清理不必要文件和使用sy

多年來,Linux軟件分佈依賴於DEB和RPM等本地格式,並深深地根深蒂固。 但是,Flatpak和Snap已經出現,有望成為應用程序包裝的通用方法。 本文考試

本指南探討了用於比較Linux中文本文件的各種方法,Linux是系統管理員和開發人員的關鍵任務。 我們將介紹命令行工具和視覺差異工具,突出顯示其優勢和適當的用例。 假設

Linux和Windows在用戶賬戶管理上的主要區別在於權限模型和管理工具。 Linux使用基於Unix的權限模型和命令行工具(如useradd、usermod、userdel),而Windows採用自己的安全模型和圖形用戶界面(GUI)管理工具。
