Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

How do I check the SHA1 hash of a file?

share|improve this question

3 Answers 3

up vote 54 down vote accepted


Print or check SHA1 (160-bit) checksums. With no FILE, or when FILE is -, read standard input.

sha1sum {file}

If you want to send the file together with its sha1sum output redirect the output to a file:

sha1sum {file} > {file}.sha1

Send both files and the other party can do a...

sha1sum -c {file}.sha1

It should show OK if the sha1 is correct.

share|improve this answer
Great! But how do you run sha1sum -c when {file}.sha1 contains only the hash and no filename (as often to be downloaded from various corners of the Internet)? I came up with for f in *.sha1; do echo "$(cat $f) ${f/.sha1/}"; done | sha1sum -c (note double space), but this must be much simpler. – Piotr Findeisen Oct 17 '13 at 1:45
or shasum -- the default SHA is (if I am correct) SHA1. Also you set it with -a, --algorithm option: shasum -a 1 – xealits Sep 23 at 15:05

Without creating local file:

$ sha1sum filename

8dd10000eb1b768800000e1d2fe1c3100005d2dc *filename

For checking, go to the directory that contains filename and run this command:

echo "8dd10000eb1b768800000e1d2fe1c3100005d2dc *filename" | sha1sum -c -
share|improve this answer

Its very simple.

Nagivate to the terminal and key in

sha1sum  filename

to confirm a sha1 hash use,

sha1sum -c filename
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.