LLI Wiki — My Digital Knowledge Base

Verify file hashes on Windows and Linux

PowerShell and Linux commands to compute and verify SHA-256 and MD5 file hashes.

This note gathers the common commands for computing a file's hash (fingerprint) and verifying its integrity, on Windows with PowerShell and on Linux.

Windows (PowerShell)

Compute the SHA-256 hash of a file:

Get-FileHash -Algorithm SHA256 C:\tools\SysinternalsSuite\PsExec.exe

Linux

Compute the SHA-256 hash of a file:

sha256sum <file>

SHA-256 hash of a string (without a trailing newline):

echo -n foobar | sha256sum

Verify a file against an expected MD5 hash. The command prints package.deb: OK when the hash matches:

echo "<expected-md5>  package.deb" | md5sum -c -

Graphical tools

Online check

VirusTotal lets you look up a file by its hash.

Notes

Mastodon LLIMastodon SocialFosstodon