Because almost any change to a file will cause its MD5 hash to also change, the MD5 hash is commonly used to verify the integrity of files (i.e., to verify that a file has not changed as a result of file transfer, disk error, meddling, etc.). The md5sum program is installed by default in most Unix, Linux, and Unix-like operating systems or compatibility layers. BSD variants (including Mac OS X) have a similar utility called md5. Versions for Microsoft Windows do exist (see external links).
Note that a cryptanalytic attack on the MD5 algorithm has been found , which means a method has been found to calculate a file that will have a given md5sum in less than the time required for a brute force attack. Although it would still be quite computationally expensive to construct such a file, md5sum should not be used in situations where security is important (such as cryptographic hashing). It is still useful for general-purpose file integrity verification, such as protecting against random bit flips.
If file is not present, omitting the file parameter or passing a - reads from standard input.