Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 09-21-2007, 04:37 PM   #1
LQ Newbie
Registered: Jun 2007
Posts: 16

Rep: Reputation: 0
byte to byte remote comparison


is there a way to compare byte to byte files or folders on a local machine to a files or folders on a remote machine (some kind of remote cmp))?


Last edited by louisJ; 09-21-2007 at 04:38 PM.
Old 09-21-2007, 04:59 PM   #2
Registered: Jul 2004
Location: Jemna, Tunisia
Posts: 46

Rep: Reputation: 15
just mount the remote folders

all you need is mounting the remote files/folders and execute your comparison task as usual (as it's a local one). You can use NFS to mount remote files/folders.
Old 09-21-2007, 06:04 PM   #3
Junior Hacker
Senior Member
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 61
You can run an algorithm against the two, if the sum is the same, the files are the same, by running the sha1sum for example:
sha1sum /path/to/file_name
If there is a difference in the output of the sha1sum command on both, you can then use diff to compare the files line by line.
Old 09-21-2007, 06:28 PM   #4
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677
Is the directory structure of the files the same on both machines?
If so and you have ssh access, you could run something like:
find /path/to/directory -type f -exec md5sum '{}' \; >local.md5
on the local machine.

Then copy the local.md5 file to the same base directory on the remote machine and log in with ssh.
md5sum --check local.md5 >results

This uses the checksum results from the local machine to check the files on the remote machine, running md5sum on the remote machine.

You can then filter out positive results:
sed '/: OK/d' results | less

This will probably be faster than running cmp over the network. Especially if you have hundreds or thousands of files to check.

Last edited by jschiwal; 09-21-2007 at 06:29 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How to byte-get an image? kornerr Programming 9 04-24-2006 08:25 PM
Byte Benchmarks kiwi_bloke Linux - Software 1 08-17-2004 01:07 AM
0 byte logs dsieme01 Linux - Security 5 07-22-2004 11:13 AM
C++ byte type exodist Programming 3 05-11-2004 06:02 PM
backup byte-for-byte axion0917 Linux - Software 2 12-11-2003 06:01 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:03 AM.

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