Back to commands

Linux Survival Basics

Read-only

List Installed RPM Kernels

You need installed kernel package versions on RPM-family hosts.

Command

rpm -q kernel

Before you run this

System impact: Read-only. Low when scoped to the shown target.

When not to use it: Do not remove the running kernel.

Expected output

Installed kernel package versions or a message if the package is missing.

System impact

Read-only. Nothing changes. The command reads current state and prints diagnostic evidence.

Recovery / rollback: no state is changed.

When to use it

Use on RHEL, Fedora, Alma, Rocky, or similar systems.

When not to use it

Do not remove the running kernel.

Example run

Commands shown

These are the commands shown for inspection. Treat them as an example, not proof that your system will behave identically.

  1. rpm -q kernel
  2. rpm -q kernel

next steps

Related commands

Linux Survival Basics Read-only

List Installed Debian Kernels

Know installed kernels before cleanup.

dpkg -l 'linux-image*' | awk '/^ii/{print $2,$3}'
Linux Survival Basics Read-only

Compare Kernel and Distro Versions

The distro version and kernel version answer different questions.

printf 'kernel=%s arch=%s distro=%s\n' "$(uname -r)" "$(uname -m)" "$(lsb_release -ds)"
Linux Survival Basics Read-only

List Installed Package Versions

A package inventory beats memory when a server is drifting.

dpkg-query -W -f='${Package}\t${Version}\t${Architecture}\n' | sort

next diagnostic step

Where to go from this command

Study mapping

Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.

  • LPIC-1 style command-line practice
  • LFCS style performance-task practice
  • Linux+ style troubleshooting review

Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.