Linux command
sha256sum 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Calculate the SHA256 checksum
sha256sum [file]
Calculate checksums
sha256sum [file1] [file2]
Read from stdin
echo "text" | sha256sum
Generate a checksum file
sha256sum [file1] [file2] > [checksums.sha256]
Verify files
sha256sum -c [checksums.sha256]
Verify silently
sha256sum -c --quiet [checksums.sha256]
说明
sha256sum computes and verifies SHA-256 cryptographic hash values. SHA-256 (Secure Hash Algorithm 256-bit) is part of the SHA-2 family and produces a 256-bit (32-byte) hash value, typically rendered as a 64-character hexadecimal number. The command is commonly used to verify file integrity and authenticity. Software distributors often provide SHA256 checksums alongside downloads, allowing users to verify that files were not corrupted during transfer or tampered with. When checking files with -c, the input file should contain lines in the format produced by sha256sum: the hash, two spaces (or a space and asterisk for binary mode), and the filename.
参数
- -b, --binary
- Read in binary mode
- -c, --check
- Read checksums from file and verify them
- -t, --text
- Read in text mode (default)
- --tag
- Create a BSD-style checksum output
- -z, --zero
- End each output line with NUL, not newline, and disable filename escaping
- --quiet
- Don't print OK for each verified file
- --status
- Don't output anything, exit code shows success
- -w, --warn
- Warn about improperly formatted checksum lines
- --strict
- Exit non-zero for improperly formatted checksum lines
- --ignore-missing
- Don't fail for missing files during verification
- --help
- Display help information
- --version
- Display version information
FAQ
What is the sha256sum command used for?
sha256sum computes and verifies SHA-256 cryptographic hash values. SHA-256 (Secure Hash Algorithm 256-bit) is part of the SHA-2 family and produces a 256-bit (32-byte) hash value, typically rendered as a 64-character hexadecimal number. The command is commonly used to verify file integrity and authenticity. Software distributors often provide SHA256 checksums alongside downloads, allowing users to verify that files were not corrupted during transfer or tampered with. When checking files with -c, the input file should contain lines in the format produced by sha256sum: the hash, two spaces (or a space and asterisk for binary mode), and the filename.
How do I run a basic sha256sum example?
Run `sha256sum [file]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -b, --binary do in sha256sum?
Read in binary mode