Sha1sum command
From NetworkCommands
A command available on most Linux platforms; used to generate and display or check the SHA1 message digest (or checksum) of one or more files.
Contents |
Usage Syntax
sha1sum [options] [path/]filename
Common options include;
- -b - read files in binary mode
- -t - read files in text mode (this is the default)
- -c - check against a given list contained within the specified filename
- --status - only display a status code on success
- -w - display warnings about improperly formatted checksum file lines
filename is either the file that you wish to generate and display a checksum for, or a file containing a list of checksums and filenames that you wish to check.
Usage Examples
sha1sum test.txt - compute and display the SHA1 checksum for file test.txt
sha1sum --check -w checksums.txt - check the checksums of the files and associated checksums listed in file checksums.txt and warn if lines in checksums.txt are improperly formatted
Usage Notes
The --status and -w options are only relevant when -c is used.
Here's an example checksum list file:
fdba2b328619f60823dd3254c63309e39a3ce2a3 test.txt 41ef29701323b6103a5404a59f0d994e6d20d63a *test2
The * indicates a binary file
An SAH1 checksum is always 160bits (or 20Bytes.)
Linux Usage Notes
With most Linux or Unix commands;
- Brief help can be displayed using the option/keyword: -h or --help, for example: chmod --help
- A full command manual can be displayed using the man command followed by the command name, for example: man chmod
- Sometimes 'info' pages are used instead of or to provide more information than man pages; for example: info chmod
- Version information can be display using the option/keyword: -v or --version, for example: chmod --version
Typical Output
[user@test] ~ # sha1sum test.txt
fdba2b328619f60823dd3254c63309e39a3ce2a3 test.txt
[user@test] ~ # sha1sum test2.txt
41ef29701323b6103a5404a59f0d994e6d20d63a test2.txt
[user@test] ~ # more checksums.txt
fdba2b328619f60823dd3254c63309e39a3ce2a3 test.txt 41ef29701323b6103a5404a59f0d994e6d20d63a test2.txt
[user@test] ~ # sha1sum --check -w checksums.txt
test.txt: OK test2.txt: OK
Related Files
sha1sum is normally located here: /usr/bin/sha1sum
Related Commands
The md5sum command performs the same function for MD5 message digests.
The OpenSSL dgst command performs the same function while also supporting many other digests.
Related Articles
Information on other Linux commands
Information on other Secure Platform commands
Information on F5 BigIP commands
Information on Cisco commands
Information on Vyatta commands
Information on Extreme commands
Information on Blue Coat SGOS commands
Information on Nokia IPSO commands







