Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i have one file which exists in 2 different unix machines. how i can compare the data with in the file

share|improve this question

You can compare files remotely using ssh:

$ ssh -p 2022 localhost "cat /remote_path" | diff - /local_path
$ ssh -p 2022 localhost "cat /etc/lsb-release" | diff - /etc/lsb-release

Or use sshfs/nfs.

share|improve this answer
hi, thanks for your reply . actually i have list of files in one directory in 2 unix boxes . i need to compare all the files data between 2 unix boxes. how i can do for list of files data comparision in unix . – Navadeep Feb 17 '11 at 11:26
@Navadeep Use sshfs and 'diff -r' – ooshro Feb 17 '11 at 11:55

shortest way to figure if they are 'same' could be

md5sum file on each box, and compare if md5sums match (or some other sum)

if you want to diff them , copy one file over to other box and diff it.

share|improve this answer
md5sum isn't a way «to figure if they are 'same'». It's rather a way to figure out whether they're different, ЕВПОЧЯ. :-) – poige Feb 17 '11 at 11:15
hi,thanks for your reply – Navadeep Feb 17 '11 at 11:18
hi,thanks for your reply.actually i dont have write access in another unix box .i can only check the file data is same or not if the data is not same i need to send a mail.... – Navadeep Feb 17 '11 at 11:21

Remotely? Do you have NFS running? Is the directory containing the file of one of the machines mounted on the other machine? You could check this with " df ".

If you don't have NFS or the directory is not mounted you will have to copy the file. You could use " scp " to copy the file.

For comparing them use diff or if installed kdiff3 or mgdiff are nice. " diff -y " shows a side by side output.

share|improve this answer
vimdiff file scp://login@server//pathto/file

the double / after server is not a typo

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.