Computer line ending systems By Armando Caussade, http://armandocaussade.org/ Version 1. March 4, 2019. Copyright © 2019 Armando Caussade. Some rights reserved. Creative Commons License BY–NC–ND 4.0. ----- There are three line ending systems used with modern computer operating systems: LF Line feed \n ASCII code 10 Amiga, Unix, Linux, Apple OS X and later CR Carriage Return \r ASCII code 13 Commodore, Apple Mac OS 9 and earlier CR + LF Carriage Return + Line Feed \r\n ASCII code 13 + 10 CP/M, DOS, IBM OS/2, Microsoft Windows A concise explanation follows: - The LF system movs the cursor down to the next line without returning to the beginning of the line. - The CR system moves the cursor to the beginning of the line without advancing to the next line. - The CR + LF system moves the cursor both down to the next line and to the beginning of that line. Common text editors on Linux (like GEdit, Xed, Kate and Leafpad) are able to read and write all three systems. In contrast, the classic Notepad editor in Microsoft Windows did not gain this ability until 2018. On Unix systems one may use the "file" command to inquire which line ending system a text file uses. BSD systems and most Linux distributions use a free, open source reimplementation of the "file" command which was written in 1986-87 from scratch. $ file sample1.txt sample1.txt: ASCII text, with CRLF line terminators (this means CR + LF endings, used by Microsoft Windows) $ file sample2.txt sample2.txt: ASCII text (this means LF endings, used by Linux) ###