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

In the process of comparing files between 2 versions of an application i've noticed that a number of files seem to have gained additional blank lines throughout the file. These files were never uploaded by FTP, purely copied from one location to another using cp and its not even every single file in the directory, just seemingly random ones. When i do a diff between the files in a side by side format ignoring spaces, newlines etc i just see a bunch of caveats showing the difference as the new line, so this:

diff --suppress-common-lines -Bbwy /home/site1/public_html/file.php /home/site2/public_html/file.php

outputs something like this:


I guess this is 2 questions then:

why would the file have gained these extra new lines, is this a line ending issue somehow and how can i check?

Is it possible to do a diff that will completely ignore these lines and recognise the files as identical which essentially they seem to be?

FYI this is on a CentOS server.

share|improve this question
I think we need to see exactly what technique you're using to copy the files. Newlines are just bytes, and it's approaching impossible that 'cp' is adding bytes to your files. Are you certain that an editor hasn't opened one copy or the other in the meantime? – pboin Jul 6 '11 at 12:14
MSDOS/FAT/VFAT filesystems have auto conversion options. Maybe one of the locations is such an FS. – AndreasM Jul 12 '11 at 6:27
up vote 1 down vote accepted

It seems that this was caused by another Developer having an auto-sync setting with his copy of Dreamweaver.

share|improve this answer

Part 1: Could be several things, like pboin mentioned, if you open it in an editor, it can add a newline or convert line endings, or I commented, if the source or target file system is an MSDOS/FAT partition.

Part 2: try --strip-trailing-cr

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.