Two special characters are involved here:
- Carriage Return (CR or \r in many programming languages)
- Line Feed (LR or \n)
I never understood what those terms mean until I read that they are inherited from typewriters. When typing on a type writer, two physical actions have to happen in order to continue typing on the next line. First, the carriage needs to return to the very beginning (the far left and makes the ding sound). Then, the typewriter needs to move the page up a little so that we can type on a new line. The moving page up action is called line feed.
CR+LR (i.e. \r\n) to denote a new line but on Unix and Unix-like machines (e.g. Linux), only
LF or \n is used.