Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I've 2 configuration files in linux. One file size is 177bytes and 2nd one is 183 bytes. Checked size by following command:

wc -c Config

both files have 100% same text, same name (different folders). I matched word by word as there are only 6 lines. Also compared by using CompareIT in windows. Now problem is that when I run my program with Config file of 177 bytes, then it works. and when I run my program with Config file of size 183 then it doesn't work. Now I'm unable to understand that how can I distinguish between both files? what is the difference that is creating problem as i have to keep checking every time that I'm using file of 177 bytes. that configuration files contains:


Kindly help me to identify difference. thanks in advance.

share|improve this question

closed as off-topic by Ward, mdpc, kasperd, Andrew Schulman, Jenny D Apr 19 at 10:00

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on Server Fault must be about managing information technology systems in a business environment. Home and end-user computing questions may be asked on Super User, and questions about development, testing and development tools may be asked on Stack Overflow." – mdpc, kasperd, Andrew Schulman, Jenny D
If this question can be reworded to fit the rules in the help center, please edit the question.

3 Answers 3

up vote 3 down vote accepted

The difference is probably just white space. Open up each in a hex editor to verify.

share|improve this answer
I'm venture a guess that one has LF line endings, while the other has CRLF endings. – Shane Madden Apr 29 '12 at 2:29

We have the technology to show the difference between two files automagically. diff is the canonical option, and will show you which lines are different (so you can narrow down your search). cmp, in contrast, won't give you such friendly output, but it does tell you exactly which byte in the file is different.

I'd say, however, that any program that barfs just because whitespace has changed in it's config file probably is one you want to be running away from very quickly (preferably after putting the author of said nightmare out of their misery -- for the sake of anyone else who might come across them in the future, if nothing else).

share|improve this answer

The difference is either in whitespace or the newline char.

On windows, the newline char (char that gets you in the new line). On unix systems, it simply \n. On windows systems it's \r\n (carriage-return, newline (linefeed)).

Check it with the hex editor, or find "dos2unix" tool to convert and then compare with "diff".

If one of the files was created on Windows and the other on a unix box, that would probably be the difference.

share|improve this answer

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