md5sum myfile > myfile.md5 # generate md5sum md5sum -c myfile.md5 # check and output a message md5sum --status -c myfile.md5 # check but only store result un $? if [ $? -eq 0 ]; then echo "ok" else echo "ko" fi