Linux Survival Basics
Read-only, sensitive outputFind 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.
ssh-keygen -F hostnamessh-keygen -F hostname
next steps
Related commands
Find known_hosts Lines by Name
See the stored entry before editing.
grep -n 'hostname' ~/.ssh/known_hosts
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
Scan a Host SSH Key
Keyscan collects a presented key; it does not verify trust.
ssh-keyscan -t ed25519 hostname
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"'
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
- SSH known_hosts changed hub Use when SSH warns about host identity.
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.
Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.