How to get only sha512sum of a file in Ubuntu 14?

454 Views Asked by At

I'm trying to assign sha512sum of a tar.gz file to a variable in shell in ubuntu 14.

I tried sha512sum mentioned here https://manpages.ubuntu.com/manpages/xenial/man1/sha512sum.1.html

But it's printing both 512sum and also the file_name.

But I'm only looking for the sum in this case. Are there any flags that I can pass? I didn't find any such in the manpage for sha512sum.

1

There are 1 best solutions below

0
On BEST ANSWER

Pipe it to cut and use the first field.

sha512sum  FILENAME  | cut -d ' ' -f 1

Options don't seem to be there.