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


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


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



-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:
don’t output anything, status code shows success
-w, –warn
warn about improperly formated checksum lines

Note: Join free Sanfoundry classes at Telegram or Youtube


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:

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

Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.

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

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 & discussions at Telegram SanfoundryClasses.