Back to commands

Linux Survival Basics

Read-only

List Installed Debian Kernels

You need Debian/Ubuntu kernel package names and versions.

Command

dpkg -l 'linux-image*' | awk '/^ii/{print $2,$3}'

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 Linux image packages and versions.

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 after confirming /boot pressure.

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. dpkg -l 'linux-image*'
  2. dpkg -l 'linux-image*' | awk '/^ii/{print $2,$3}'

next steps

Related commands

Linux Survival Basics Read-only

Find Broken or Leftover dpkg States

Not every package row is cleanly installed.

dpkg-query -W -f='${db:Status-Abbrev}\t${Package}\n' | awk '$1 !~ /^ii$/'
Linux Survival Basics Read-only

Show Context Around the First App Error

The first error often explains more than the last one.

awk '{buf[NR%5]=$0} tolower($0) ~ /(error|exception|fatal)/ {for (i=NR-4;i<=NR;i++) if (i>0) print buf[i%5]; exit}' /var/log/app/app.log
Linux Survival Basics Read-only

Map systemd Timers to Services

A timer is only half the scheduled job. The service is the payload.

systemctl list-timers --all --no-pager --plain | awk 'NR==1 || /\.timer/ {print $(NF-1), "->", $NF}'
Linux Survival Basics Read-only

Spot Foreign-Architecture Packages

One unexpected architecture can explain confusing dependency output.

dpkg-query -W -f='${Architecture}\t${Package}\n' | awk '$1 != "amd64" && $1 != "all"'
Linux Survival Basics Read-only

Find the Largest Installed Packages

Disk cleanup starts with evidence, not random package removal.

dpkg-query -W -f='${Installed-Size}\t${Package}\n' | sort -nr | head -20

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.