it's one of those things that you encounter now and then and if you do any text file processing, it's handy to have a little background. Before monitors and CRTs existed there were teletypes (also known as teleprinter or teletypewriter) effectively big electric typewriters.
In my first year at University in 1977 we were taught on teletypes but VDUs (early monitors, short for Visual Display Unit) replaced them within a few years. Back then when I hit a key on the teletype, it was sent to the mainframe I was connected to and it sent it back to the terminal to be printed. As they could only print at 10 or 30 characters per second, listings could take a while and it was a noisy environment. Lots of people preferred them though because you got a printed listing straight away. When we got VDUs we had to send listings to the computer center printers and walk over there to pick them up.
From 1960 onwards there were two symbols CR (\r in C/C++ value 13 ) and LF (\n value 10) that were used with teletypes and retained in ASCII.
CR was short for Carriage Return and meant the print head would move to the left of the line. LF was short for Line Feed and meant the paper moved up by one line. Although Unix was first and used the LineFeed symbol to mark the end of a line in a text file, Windows used both CR and LF in files and so it remains today. Thankfully modern text editors can spot the difference and convert between them. If you are handling text files in your code, it makes sense to be able to deal with both CR/LF and LF line endings.


I see where they come from, in java we learn to use /n to get to the new line, when I used C# I used the same but I have never get to the new line till I figured out that I need /r/n
when I open a text file from linux in windows all content appear in one line which was annoying(now using Notepad++)