Linux command
md5sum 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Calculate MD5 hash
md5sum [file]
Calculate hash
md5sum [file1] [file2] [file3]
Calculate hash
echo "text" | md5sum
Save hashes
md5sum [*.iso] > checksums.md5
Verify files
md5sum -c checksums.md5
Verify silently
md5sum -c --quiet checksums.md5
Verify with status
md5sum -c --status checksums.md5
Output in BSD format
md5sum --tag [file]
说明
md5sum computes and verifies MD5 message digests (checksums). MD5 produces a 128-bit hash value, typically displayed as a 32-character hexadecimal number. The tool is commonly used to verify file integrity after transfers, detect changes in files, and generate unique identifiers for content. Files can be checked against a previously generated checksum file. Note that MD5 is cryptographically broken and should not be used for security purposes. Use SHA-256 or better for security-critical applications.
参数
- -c, --check
- Read checksums and verify files.
- --quiet
- Don't print OK for verified files.
- --status
- Don't output, use exit status only.
- -w, --warn
- Warn about malformed checksum lines.
- --strict
- Exit non-zero for malformed lines.
- --tag
- Create BSD-style checksum output.
- -b, --binary
- Read files in binary mode.
- -t, --text
- Read files in text mode (default).
- --ignore-missing
- Ignore missing files when checking.
FAQ
What is the md5sum command used for?
md5sum computes and verifies MD5 message digests (checksums). MD5 produces a 128-bit hash value, typically displayed as a 32-character hexadecimal number. The tool is commonly used to verify file integrity after transfers, detect changes in files, and generate unique identifiers for content. Files can be checked against a previously generated checksum file. Note that MD5 is cryptographically broken and should not be used for security purposes. Use SHA-256 or better for security-critical applications.
How do I run a basic md5sum example?
Run `md5sum [file]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -c, --check do in md5sum?
Read checksums and verify files.