Use md5sum to verify the file accuracy-general Linux technology-Linux technology and application information. The following is a detailed description. In general, we first install linux images from the Internet, and then install or burn the hard disk to a CD before using it.
Before using these downloaded files, we must check the correctness. Otherwise, it may be a waste of time or CD.
When the download site provides the content itself, it also provides a file named MD5SUM or similar name.
In fact, this file is used for verification.
The following describes the entire process of using md5sum through a comprehensive small instance.
Requirement: upload files under/var/www to another machine through a network or a mobile hard disk.
Steps:
Cd/var/www
Md5sum *> MD5SUM
If/var/www contains folders, an error message is displayed, as shown in the following figure:
Md5sum: ajax: Is a directory
Md5sum: apache2-default: Is a directory
Md5sum: blog: Is a directory
Md5sum: codeblocks: Is a directory
Md5sum: download: Is a directory
Md5sum: php100: Is a directory
Now we can move it to another location by various means. Assuming that the file has been moved, we need to verify whether the file is damaged during the moving process. Assume that the folder content is moved to/tmp/test:
Cd/tmp/test
Md5sum-c MD5SUM
The output in this example is:
Hack2.js: OK
Hack2.js ~ : OK
Index2.php: OK
Ipgw. py: OK
Md5sum: OK
Phpinfo. php: OK
R. php: OK
R. php ~ : OK
S.html: OK
S.html ~ : OK
Ss.html: OK
Ss.html ~ : OK
W21 ~ : OK
W21.html: OK
W21.html ~ : OK
W2.html: OK
W2.html ~ : OK
If all the output results are OK, the content is not changed.
Here, we can simulate a transmission error.
Make any modification in the r. php file. Here, a space is added at the beginning. The result is as follows:
Cube-bot-0.32.tar.gz: OK
Hack2.js: OK
Hack2.js ~ : OK
Index2.php: OK
Ipgw. py: OK
Md5sum: OK
Phpinfo. php: OK
R. php: FAILED
R. php ~ : FAILED
S.html: OK
S.html ~ : OK
Ss.html: OK
Ss.html ~ : OK
W21 ~ : OK
W21.html: OK
W21.html ~ : OK
W2.html: OK
W2.html ~ : OK
Md5sum: WARNING: 2 of 18 computed checksums did NOT match
The modification involved two files, so the verification of both files failed.
What if I delete an object? In this case, w2.html ~ Deleted. Check the result:
Cube-bot-0.32.tar.gz: OK
Hack2.js: OK
Hack2.js ~ : OK
Index2.php: OK
Ipgw. py: OK
Md5sum: OK
Phpinfo. php: OK
R. php: FAILED
R. php ~ : FAILED
S.html: OK
S.html ~ : OK
Ss.html: OK
Ss.html ~ : OK
W21 ~ : OK
W21.html: OK
W21.html ~ : OK
W2.html: OK
Md5sum: w2.html ~ : No such file or directory
W2.html ~ : FAILED open or read
Md5sum: WARNING: 1 of 18 listed files cocould not be read
Md5sum: WARNING: 2 of 17 computed checksums did NOT match
It may take a long time to upload large files!
For example, it took me almost ten minutes to verify the SUSE-Linux-10.1-GM-DVD-i386.iso I just placed. However, considering data integrity and correctness, it is worth investing.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.