Here we will see the md5sum command in Linux system. The MD5 is one of the Message Digest algorithm, that generates hash values to create checksum for the messages. It helps to identify if the integrity is maintained or not. Here we will see some example of md5sum command in Linux system.
If we use this command on a string, it will generate a hash value, if we create some minor change in the text, it will generate massive change in the checksum.
sh-4.4$ echo 'Hello World' Hello World sh-4.4$ echo 'Hello World' | md5sum e59ff97941044f85df5297e1c302d260 - sh-4.4$
If we change the content of the string ‘Hello World’ to ‘Hello world’, then the MD5 hash value will be completely different.
sh-4.4$ echo 'Hello World' | md5sum e59ff97941044f85df5297e1c302d260 - sh-4.4$ echo 'Hello world' | md5sum f0ef7081e1539ac00ef5b761b4fb01b3 - sh-4.4$
We can create a file and also get checksum for that file. The command is simple, please see the example.
sh-4.4$ cat sample.txt This is sample text sh-4.4$ md5sum sample.txt 7d01d6303e91e880ad6ad10a7aa10537 sample.txt sh-4.4$