LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-08-2010, 06:33 PM   #1
fuzzylogic25
LQ Newbie
 
Registered: Jun 2009
Posts: 3

Rep: Reputation: 0
cmp or diff? which is more accurate? work for any file?


When I read the man pages for "diff", it says compare files line by line. Then when I read man pages for "cmp" it says compare two files byte by byte.

Someone said to me cmp is more accurate for data verification since it does comparison byte by byte. The way I see it though, is that even diff does a byte by byte comparison, I mean if two lines are identical, then that implies that each character is identical, which means each byte is indeitical. Am i correct here?

Also, this means it is doin a comparison at the binary level yes?

You see, I have drives which contain back ups (like 100GB+) of data. This data is in form of files with several subdirectories etc. So I want to do a file verification to ensure that the back up hard disk and original hard disk are identical (so binary comparison, for best accuracy). The files are all sorts of datatype, so not just text. Even AVI files.

diff seems to be best for my needs as I just give it a directory and it goes through all sub directories too if i specify to do so. cmp requires me to write a shell file. Also for one file comarisons, i noticed cmp is slower, does that mean it is indeed more accurate?

Is there an alternative method for comparing files/folders?
 
Old 06-09-2010, 01:00 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,356

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Look into checksums, md5 hashes etc. Binary comparisons can be fiddly.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
diff file elainelaw Linux - Software 2 07-23-2009 04:07 AM
.diff file help... netpumber Slackware 14 02-18-2009 02:26 PM
diff file ust Linux - Newbie 2 07-19-2008 06:56 AM
which should I use? diff cmp comm Frybyte Linux - Newbie 2 07-19-2004 08:22 AM
What is *.diff file? carboncopy Slackware 1 05-19-2004 10:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration