Windows has a certain format, and if a file is to be used in Linux, the line endings have to be converted. Isn't the line ending just a character like any other? Why is it treated specially?
Asked
Active
Viewed 287 times
-1
-
Windows uses 2 characters "carriage return" and "line feed", Just like the 2 operations on your typewriter. Linux only uses one character thus breaking the whole computer/typewriter similarity... – John3136 Feb 04 '16 at 06:11
1 Answers
0
There are actually a variety of ways to indicate a record. Most operating systems used to support records with a line count. The first 2 or 4 bytes specified the length of the record. In fact, the Unix alternatives of the 70's-90's often supported indexing and random access.
Unix used dumbed-down system (great for simplicity) of just using a line-feed character to indicate record breaks.
This requires the terminal driver (or application) to convert the <LF>
character into a <CR><LF>
pair for display. Otherwise typing a file would give
Line 1
Line 2
Line 3
Rather than
Line 1
Line 2
Line 3
MS-DOG went even simpler than Unix and adopted the convention of using a <CR><LF>
pair to mark the end of records. No translation needed to type a file.

Mr Lister
- 45,515
- 15
- 108
- 150

user3344003
- 20,574
- 3
- 26
- 62