Print md5sum of results of a find command in Linux

James Mclaren picture James Mclaren · Feb 8, 2013 · Viewed 13.8k times · Source

I am tryng to do checksum on all .jar files I can find in directory and its sub directories. Then print the filename with the checksum value to a file.

this is what I have.

md5sum | find -name *.jar >result.txt

I am trying to join two commands together that I know work individually.

Any help appreciated.

Answer

iabdalkader picture iabdalkader · Feb 8, 2013

You could use something like this to execute a command on each file:

find . -name "*.jar" -exec md5sum {} \; >result