← 返回命令列表

Linux command

sha1sum 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Calculate the SHA1 checksum

sha1sum [path/to/file]

Calculate checksums for multiple files

sha1sum [file1] [file2] [file3]

Calculate and save checksums

sha1sum [*.iso] > [checksums.sha1]

Verify checksums

sha1sum -c [checksums.sha1]

Verify silently

sha1sum -c --quiet [checksums.sha1]

Read from stdin

echo -n "[text]" | sha1sum

说明

sha1sum computes and verifies SHA1 (160-bit) message digests as described in FIPS-180-1. It generates a unique 40-character hexadecimal hash for file contents, useful for verifying file integrity and detecting modifications. With no FILE argument or when FILE is -, sha1sum reads from standard input. Output format is: checksum, space, mode indicator (* for binary, space for text), and filename. When checking with -c, input should be previous sha1sum output. Each line is verified and reported as OK or FAILED.

参数

-b, --binary
Read in binary mode
-c, --check
Read checksums from FILEs 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 instead of newline
--ignore-missing
Don't fail for missing files when checking
--quiet
Don't print OK for each successfully verified file
--status
Don't output anything; use exit status for result
--strict
Exit non-zero for improperly formatted checksum lines
-w, --warn
Warn about improperly formatted checksum lines

FAQ

What is the sha1sum command used for?

sha1sum computes and verifies SHA1 (160-bit) message digests as described in FIPS-180-1. It generates a unique 40-character hexadecimal hash for file contents, useful for verifying file integrity and detecting modifications. With no FILE argument or when FILE is -, sha1sum reads from standard input. Output format is: checksum, space, mode indicator (* for binary, space for text), and filename. When checking with -c, input should be previous sha1sum output. Each line is verified and reported as OK or FAILED.

How do I run a basic sha1sum example?

Run `sha1sum [path/to/file]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -b, --binary do in sha1sum?

Read in binary mode