Linux/Unix uses the md5sum command to compare file md5 values ​​

  
                

md5sum is a shell command in Linux/Unix. It can be used for file verification. For example, if two files are the same, the following small series will introduce you how Linux/Unix compares two files using md5sum.

Recommended: Ubuntu gnome 32-bit Standard Edition Download

1. Introduction

The MD5 algorithm is often used to verify the integrity of network file transfers and prevent files from being tampered with. The MD5 full name is the Message-Digest Algorithm 5, which calculates the information of any length bit by bit, and produces a fingerprint with a length of 128 bits (the length of the hexadecimal is 32 bits). (Or called "message digest", the possibility that different files produce the same message digest is very, very small.

On Linux or Unix, md5sum is a utility for calculating and verifying file message digests. In general, after installing Linux, there will be a tool called md5sum, which runs directly on the command line terminal.

2, command format

md5sum [OPTION]. . . [FILE]. . .

3, command options

-b or --binary: treat the input file as a binary file.

-t or --text : treat the input file as a text file (default).

-c or --check : Used to read the md5 information from the file to check the consistency of the file. (Don't elaborate on info)

--status: This option is used with check. When checking, it does not output, but indicates the result based on the return value.

-w or --warn : In the check, check the input md5 information and there is no illegal line, if there is, output the corresponding information.

4, an example

(1) md5 producing a value document, as shown

(2) Check whether the file is the same as FIG two, by Compare the md5 values ​​of the two files.

(3) determines whether a file modification, is determined by md5

The above is a Linux /Unix used to compare two files md5sum whether the same manner as described herein This example is used to illustrate the use of the md5sum command, which can also be used to create md5 code.

Copyright © Windows knowledge All Rights Reserved