Generate and Verify Files with MD5 Checksum in Linux

How to generate and Verify Files with MD5 Checksum in Linux. in my post, to create "checksum" folder and 3 file: file_md5,file2_md5,file3_md5 in "checksum" folder.

You may reading link below :
MD5 sums are 128-bit character strings(numerals and letters) resulting from running the MD5 algorithm.
To create checksum folder with 3 files
$ mkdir checksum
$ echo "huuphan.com" > file_md5
$ echo "Phan Van Huu" > file2_md5
$ echo "huupv" > file3_md5
$ ls -ll
total 12
-rw-r--r-- 1 huupv huupv 13 Jul 13 09:04 file2_md5
-rw-r--r-- 1 huupv huupv  6 Jul 13 09:04 file3_md5
-rw-r--r-- 1 huupv huupv 12 Jul 13 09:03 file_md5

To generate MD5 Checksum on a single file
$ md5sum file_md5
01ff693ecd0492aca683eed0dcd2bb44  file_md5

To generate MD5 Checksum on multiple files
$ md5sum file2_md5 file3_md5
de241737f915f7f10245f8362cfe7cf9  file2_md5
01380acd4b4e611399ee7087bf78642b  file3_md5
To generate MD5 Checksum and ouptut to file
$ md5sum file2_md5 file3_md5 > md5check.txt
$ cat md5check.txt
de241737f915f7f10245f8362cfe7cf9  file2_md5
01380acd4b4e611399ee7087bf78642b  file3_md5

To compare MD5 Checkum output file to current file in directory

$ md5sum -c md5check.txt
file2_md5: OK
file3_md5: OK

if you modify file, then md5sum checksum faild.
$ echo "if you modify file then, md5sum faild" >> file2_md5
$ md5sum -c md5check.txt
file2_md5: FAILED
file3_md5: OK
md5sum: WARNING: 1 computed checksum did NOT match
you run command md5sum again after modify file
$ md5sum file2_md5 file3_md5 > md5check.txt

Comments

Popular posts from this blog

zimbra some services are not running [Solve problem]

How to install php7 on centos 6

Bash script list all IP addresses connected to Server