Show an SSH Key Fingerprint with ssh-keygen -l
Verify which key is which by its short SHA256 fingerprint before adding it to servers or services.
Run ssh-keygen -lf ~/.ssh/id_ed25519.pub to print the key's SHA256 fingerprint, size and comment in one line.
01Command
Command
$ ssh-keygen -lf ~/.ssh/id_ed25519.pub02What it does
Public keys are long and visually indistinguishable, but their fingerprints are short and unique, so -l is the practical way to confirm you copied the right key. -f names the file to read (without it ssh-keygen -l also works on known_hosts entries). The same technique verifies server host keys: compare ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub output against what you see on first login to rule out man-in-the-middle attacks.
03Risk
!Warning: Fingerprints identify keys, they don't validate trust — always compare against a value obtained through a second channel (server console, provider dashboard).
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- ssh-keygen(1) — Ubuntu man pageEvidence: Man page text includes the -l fingerprint option ('Show fingerprint of specified public key file') and -f filename option.
- ssh-keygen(1) — Linux man pageEvidence: Documents -l ('Show fingerprint of specified public key file') and -f filename; confirms '-l' and 'fingerprint' appear in the man page text.
Last verified: 2026-09-19 · Category: Security & Privacy