首先看个最简单的例子:
$ md5sum ./1/iAmCdRom.iso ./2/iAmCdRom.iso
773682e3494b6155855dd580bef8cb04 ./1/iAmCdRom.iso
34d75a13d98b245c2a32a0bf816abb36 ./2/iAmCdRom.iso
//更多详细的选项如下:
$ md5sum --help
Usage: md5sum [OPTION]... [FILE]...
Print or check MD5 (128-bit) checksums.
With no FILE, or when FILE is -, read standard input.
-b, --binary read in binary mode
-c, --check read MD5 sums from the FILEs and check them
-t, --text read in text mode (default)
本人还是推荐binary二进制传输
产线的烧录文件等,由于涉及到大批量等问题,传输过程更不能有任何差错。
且一般都是二进制文件。(如ftp工具设置不当:如文本格式或二进制传输的差别)
当然,你生成了MD5号,最重要的是使用的时候去验证:
md5sum youfile > youfile.md5
md5sum -c you.md5
举个栗子:
echo hello > hello.txt
md5sum hello.txt > hello.md5
md5sum -c hello.md5
hello.txt: OK (ok是我们希望看到的)