Back to commands

Linux Survival Basics

Read-only, sensitive output

Find a Host in known_hosts

You need to see whether a host has a known_hosts entry.

Command

ssh-keygen -F hostname

Before you run this

System impact: Read-only. Output may expose users, paths, tokens, keys, IPs, process arguments, or log details.

When not to use it: Do not remove entries before verifying the new fingerprint out of band.

Expected output

Matching known_hosts entries or no output if none are found.

System impact

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

Recovery / rollback: no state is changed.

When to use it

Use when SSH warns that a host key changed.

When not to use it

Do not remove entries before verifying the new fingerprint out of band.

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. ssh-keygen -F hostname
  2. ssh-keygen -F hostname

next steps

Related commands

Linux Survival Basics Can be slow

Find Running Package Manager Processes

A package lock is usually a symptom, not the first thing to delete.

ps -ef | grep -E 'apt|dpkg|dnf|yum|pacman' | grep -v grep
Linux Survival Basics Sensitive output

Scan a Host SSH Key

Keyscan collects a presented key; it does not verify trust.

ssh-keyscan -t ed25519 hostname
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 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$/'

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.