Search code examples
ubuntuchecksumsha512ubuntu-14.10

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


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.


Solution

  • Pipe it to cut and use the first field.

    sha512sum  FILENAME  | cut -d ' ' -f 1
    

    Options don't seem to be there.