一、md5sum
Usage: md5sum [OPTION]... [FILE]...
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
--tag create a BSD-style checksum
-t, --text read in text mode (default)
Note: There is no difference between binary and text mode option on GNU system.
The following four options are useful only when verifying checksums:
--quiet don't print OK for each successfully verified file
--status don't output anything, status code shows success
--strict exit non-zero for improperly formatted checksum lines
-w, --warn warn about improperly formatted checksum lines
--help display this help and exit
--version output version information and exit
The sums are computed as described in RFC 1321. When checking, the input
should be a former output of this program. The default mode is to print
a line with checksum, a character indicating input mode ('*' for binary,
space for text), and name for each FILE.
GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
For complete documentation, run: info coreutils 'md5sum invocation'
# 生成文件的md5sum值,通过比较两个文件的md5sum值判断两个文件是否一样
md5sum mm10.fa > mm10.fa.md5
cat mm10.fa.md5
5cd1eb06fa018a77633bc42932f20b45 mm10.fa
md5sum chromFa.tar.gz > chromFa.tar.gz.md5
cat chromFa.tar.gz.md5
cebdcdd7c2238f13ea261e3131b10b60 chromFa.tar.gz
# 很明显,两者不一样的。
二、我也不知道这是啥命令,但是一行就够了
cmp --silent mm10.fa chromFa.tar.gz && echo 'same' || echo 'different'
different