background
Today found a colleague with a file size comparison, to determine the resulting compile an executable file is not the same file. The probability of error of reason in this way is very low, but this way, once the mistakes are likely to be a ruthless pit.
So I come to share the use of md5 in terminal.
md5
1, md5 determine whether the same file
usage:
md5sum filename
For example:
➜ touch file
➜ ls
file
➜ del md5sum file
d41d8cd98f00b204e9800998ecf8427e file
The last appearance is its md5 value, use this to determine whether the same file, it will not be wrong.
2, quick access to the terminal value of the string md5
usage:
echo -n 'boy'|md5sum
Or re-cut it:
echo -n 'boy'|md5sum|cut -d ' ' -f1
For chestnut:
➜ echo -n 'boy'|md5sum
1a699ad5e06aa8a6db3bcf9cfb2f00f2 -
➜
➜ echo -n 'boy'|md5sum|cut -d ' ' -f1
1a699ad5e06aa8a6db3bcf9cfb2f00f2
and not explained echo channel, the echo is not -n newline; cut -d '' is separated by spaces, -f1 whichever is first divided value.
Remember the point of a harvest praise ~