Example
The difference between/N carriage return and/R line feed:
/ n is a line feed, / r is a carriage return
Before computers appeared, there was something called Teletype Model 33, which could type 10 characters per second.
However, it has a problem, that is, it takes 0.2 seconds to complete a line and line break, and it can exactly type two characters.
If a new character comes over in this 0.2 second, the character will be lost.
So, the developers thought of a way to solve this problem, which is to add two characters at the end of each line to indicate the end.
One is called "carriage return" and tells the typewriter to position the print head at the left border; the other is called "line feed" and tells the typewriter to move the paper down one line.
This is the origin of "line feed" and "carriage return", as can be seen from their English names.
Later, the computer was invented, and these two concepts were generally applied to the computer.
At that time, memory was expensive, and some scientists thought that adding two characters at the end of each line was too wasteful, and adding one was enough. As a result, differences emerged.
On Unix systems, the end of each line is only "<newline>", which is "/ n"; on the Windows system, the end of each line is "<newline> <carriage return", which is "/ n / r";
On Mac systems, each line ends with "<Enter>". A direct consequence is that if the file under the Unix / Mac system is opened in Windows, all the text will become one line;
If the file in Windows is opened under Unix / Mac, there may be an extra ^ M symbol at the end of each line.