On 04/25/2014 07:16 AM, Marko Mäkelä wrote: > On Thu, Apr 24, 2014 at 11:16:29PM +0200, silverdr@wfmh.org.pl wrote: >> diff - compare files line by line >> >> But diff can be used as well. > > To compare binary files that are of the same size, I often do something > like this: > > od -Ax -t x1 file1.bin > file1.txt > od -Ax -t x1 file2.bin > file2.txt > > diff -u file1.txt file2.txt Looks a bit complicated. I usually do the following: cmp file1 file2 If you don't get a complaint, they are the same. If you get a message aboug differing, you do it again with the '-l' option: cmp -l file1 file2 This will list all the differences (octal) and where they are (decimal). Then are times when I need to compare 2 whole directory trees (like verifying a backup done with 'rsync'). This is best done with diff -r dir1 dir2 and will tell you if files differ or are missing from one tree. It works with any size (tested up to 2 TB per directory). Doesn't care about text or binary. Should work on most UNIX variants. Gerrit Message was sent through the cbm-hackers mailing listReceived on 2014-04-25 15:00:07
Archive generated by hypermail 2.2.0.