Super User is a question and answer site for computer enthusiasts and power users. 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

Why do some of the more technical apps require newlines at the end of files? I've read it has something to do with diffs, but shouldn't diff be able to figure the relative positions of things out on its own?

share|improve this question
up vote 6 down vote accepted

Text file are composed of text lines, which are terminated with newlines (as opposed to being separated by newlines). So omitting the last newline technically makes the last line an incomplete text line.

share|improve this answer

I think it has more to do with appending to the end of the file. The convention is to have a newline at the end so that anything adding to the file doesn't have to worry about whether they need to make a break between the old content and the new.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .