I was trying to check the authenticity of a download by using the shasum in ubuntu. I am unable to understand the syntax though.

The code below works

  1. echo "<sha-hash> *filename" | shasum -a 256 -c

I wanted to know why are we putting a "*"(asterisk) before the file name.
I also tried generating a file using

  1. shasum -a 256 filename > file.sha
  2. shasum -a 256 -c file.sha

The above code also works. When I opened the file.sha file, I saw

<hash> <filename>

There is no asterisk present in the file. I tried writing the first statement without asterisk, but then it throws an error stating

shasum: standard input: no properly formatted SHA1 checksum lines found

1 Answer 1


Putting an asterisk before the file name tells shasum to treat the file as binary if the system supports this. Id the file should be treated as text file you use a single blank instead.

Linux doesn't make a difference between binary and text files so it doesn't matter which one you use, but you can't leave it out.

So you have to use

<hash>  <filename>

with two blanks after the hash: One blank that separates the hash from the filename and one blank for text mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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