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

How do i figure out if there's a difference between an backupfile and the current used one.
The Filename of the Backup is named like: filename_date.conf
and the currend used one is name like: filename.conf
I only need to know if the content is the same or not!

I know how to copy the files and rename it like i wish, but i don't know how to figure out if there's a content difference.

share|improve this question
You could write a script which compare files by the SHA1 checksum. – golja Jul 20 '12 at 10:40
up vote 3 down vote accepted

Use md5sum.

You can md5 remote files though ssh, like

ssh user@host md5sum filename_date.conf

then you can md5sum the local file and compare those.

share|improve this answer
thank you very much, work's like a charme :D – Harrys Kavan Jul 20 '12 at 11:19
NB: sha1 is more robust, particularly if you're concerned about intentional md5 collisions. Which are now pretty easy to engineer, if your process is open to external influence: – Dr. Edward Morbius Jul 25 '12 at 23:49

There's nothing wrong with Stone's excellent answer (+1!), but since you ask about rsync, you might want to investigate the -c flag, which tells rsync to perform a checksum (MD4, as it happens) to assist in deciding if a file has been modified, before deciding whether or not to transfer it.

share|improve this answer
thank you too, i'd have to use scp because with this date in the filename it i wouldn't be able to automize it with rsync. Maybe i'll try this after vacation :) – Harrys Kavan Jul 20 '12 at 11:20

rsync already has a lot of mechanisms to check for differences. If you aren't renaming files rsync won't transfer unchanged files.

I have used rsync to minimize transfer for open log files by only transferring the new data. The man documentation discusses your various options.

Tools like backuppc and Unison use the rsync protocol and capabilities to minimized data transfer.

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.