7:49 PM md5sum: calculate and check md5 message digest of a file in Linux |
md5sum - compute and check MD5 message digest FORMAT DESCRIPTION -b, --binary -c, --check -t, --text
Now if you change the file or modify the content of the file, the md5 checksum will change. So md5sum is the best command in linux to detect if a file has been modified or not.
Here, you may notice that the checksum has chenged!! Example: Suppose you want to detect that the file is modified and the moment it is modified, print a message "The file is modified"
In the above piece of script, we have stored the current md5 checksum of the file into "md5cur". Now we are using an until loop to compare the current md5 checksum with the new one continuously. Until the new checksum is different from the current one, the loop will continue. And the moment someone makes any chanegs in the file, the loop condition fails and we get a message "The file is modified!" Another use of this command is to make sure that the two files are same. The two files no maater where they are located, if they are having similar md5 checksum, they are totally identical files. |
|
|
Related blogs
You may also like to see:
| [2014-03-13] | [Open System-Linux] |
crontab: A command in linux to automatically start/repeat a process at certian time and interval | |
| [2014-10-24] | [Open System-Linux] |
| | |
| [2014-11-19] | [Open System-Linux] |
ETHTOOL : A tool in Linux to display or change ethernet card setting | |
| [2014-10-17] | [Open System-Linux] |
| | |
| [2014-09-24] | [Open System-Linux] |
Set, unset, display shell behaviour options : SHOPT command in Linux | |
| Total comments: 0 | |
crontab: A command in linux to automatically start/repeat a process at certian time and interval
ETHTOOL : A tool in Linux to display or change ethernet card setting
Set, unset, display shell behaviour options : SHOPT command in Linux