[Shell command] Calculate a SHA-256 hash with sha256sum

Created on November 30, 2026

You can pipe text to sha256sum to calculate its SHA-256 hash. The following command hashes the five bytes in hello.

printf '%s' 'hello' | sha256sum
2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824  -

printf '%s' writes the text without a trailing newline. The dash in the output indicates that sha256sum read from standard input.

Shell command