On Fri, 11 Jun 2010, Justin Krejci wrote:

> "Whether the End of line in the book of ASCII is a carriage return, or 
> both a carriage return and a Line feed, the text is yet unchanged.  But 
> the formatting is destroyed, like a culture without morals, it too shall 
> be destroyed.  The better is the single carriage return.  Fewer bits are 
> needed to burst transmit.* "


But seriously....

My understanding is that the history of this is that we have "control 
characters" because they controlled devices, like printers or teletypes. 
The carriage return control character, ctrl-M, moved the carriage return 
to the beginning of the line.  The line feed control character, ctrl-J, 
moved to a new line (which is why it also is called a new line character).

Also:

\r return (CR) carriage return
\n newline (LF) line feed

These two commands do the same thing:

seq 1000000 | xargs printf '%d\r'

seq -s'^M' 1000000

(but the "^M" is a carriage return not two characters -- to get that into 
your command line, type ctrl-v followed by ctrl-m).

See what those commands are doing?  Instead of printing a new line after 
every number, it just moves the cursor to the beginning of the same line 
(carriage return) and writes the new number over the old one.  This is a 
useful thing that I use a lot in scripts:

for blah in $(whatever); do something ;
echo -en "what I did\r"
done

If the carriage return were to be used for new lines (as I think it was in 
the old MacOS), we wouldn't be able to do this.

Mike