| Date: Fri, 06 Oct 2006 12:18:17 +0100
| From: Thomas Pedoussaut <thomas at pedoussaut.com>
| Timothy Murphy wrote:
| > I want to determine which files in directory foo/ on remote machine
| > A are duplicates of files in directory foo/ on my current machine.
| > What is the simplest way to do this, please?
| Use md5sum
yes (mostly) & no (just a little bit): md5sum(1) can be
used to tell you, with a high degree of certainty, which
files are identical. it will not, however, _prove_ any
two files with the same MD5 checksum are identical.
if you want to be absolutely (100%) certain two files are
identical, transfer a copy of the file from one machine
to the other, and cmp(1) them. if `cmp' thinks they are
identical, they are.
( for the paranoid, re-`md5sum'ing the transferred copy
is a useful and quick check the file was not corrupted
during the transfer. reconfirming is important if you
have a dodgy transfer medium/method. )
checksum (MD5 or other) collisions are not impossible, but
MD5 collisions are very very rare. another tool, cksum(1),
which computes the CRC, includes in its output the file's
size. that helps by making it very unlikely you have two
different files with the same CRC.
I have been known to first use md5sum(1) to find candidate
identical files, then cksum(1) as a check, and then cmp(1)
as a final check. (b.t.w., the ancient sum(1) is rather
useless and should be avoided.)
Experienced (20+ yrs) kernel/software Eng: | Brian Foster Montpellier,
• Unix, embedded, &tc; • Linux; • doc; | blf at utvinternet.ie FRANCE
• IDL, automated testing, process, &tc. | Stop E$$o (ExxonMobile)!
Résumé (CV) http://www.blf.utvinternet.ie | http://www.stopesso.com
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!