- To view the MD5 command for a local file: Md5sum FileName
To view the MD5 code for all files in the home directory:
CD ~
Find/home-type f-print0 | xargs-0 md5sum | Sort >md5.txt
To view the MD5 code for all files in the current directory:
Find./-type f-print0 | xargs-0 md5sum | Sort >md5.txt
- Generate a copy of the MD5 checksum file in the home folder using the above method
This MD5 file can be used as a checksum file for this home folder, verifying that a folder data is the same as the home directory by generating a copy of the MD5 checksum file in the same way for that folder, and then verifying that the file is the same, if the two files are the same, This is considered to be the same as the two data folders
- When the number of servers is increased, the server can not be MD5 verified by the command
The following shell script is a script-generated MD5 file.
#!/bin/bash# author:jerry.huang# Set Environment Variableslang=""Export LANGEcho ""Echo ""Echo "Please put Check_file in the same directory?"Echo ""Read-P"Is you put the check_file in the right position? (y/n):"Select_ynEcho ""Echo ""if["$select _yn"=="Y"] || ["$select _yn"=="y"]; Then Echo "start generate Data.md5 ..."CD./DataFind./-type F-print0 |Xargs-0md5sum |Sort>.. /DATA.MD5Echo "generate MD5 value over"elif["$select _yn"=="N"] || ["$select _yn"=="N"]; Then Echo "stop generate MD5 value!"Else Echo "I don ' t know what your choice is!!!"fi
md5sum Code
The Shell MD5 the files in the entire folder [go]