sha1sum Command in Linux with Examples

«
»

This tutorial explains Linux “sha1sum” command, options and its usage with examples.

sha1sum – compute and check SHA1 message digest

DESCRIPTION

Print or check SHA1 (160-bit) checksums. It is commonly used to verify the integrity of files

SYNOPSIS

sha1sum [OPTION] [FILE]…
sha1sum [OPTION] –check [FILE]

Note: Join free Sanfoundry classes at Telegram or Youtube
advertisement
advertisement

OPTIONS :

-b, –binary
read files in binary mode (default on DOS/Windows)
-c, –check
check SHA1 sums against given list
-t, –text
read files in text mode (default)

The following two options are useful only when verifying checksums:
–status
don’t output anything, status code shows success
-w, –warn
warn about improperly formated checksum lines

EXAMPLES

1. To create a file with an sha1 hash in it, if one isn’t provided execute:

$ sha1sum filename [filename] ... > SHA1SUM

2. To verify the file was downloaded correctly you can execute:

advertisement
$ sha1sum -c SHA1SUM
filename: OK
filename...: OK

Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.

advertisement
If you wish to look at all Linux commands and their usage examples, go to Linux Commands Tutorial.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & technical discussions at Telegram SanfoundryClasses.