Line separator

From LQWiki
Jump to navigation Jump to search

Linux, like Unix, uses a single line feed character (LF, \n, ASCII 0x0A) to indicate End of Line.

DOS and Windows uses a carriage return followed by a line feed (CRLF, \r\n, 0x0D 0x0A), which is generally accepted as the standard (with no lobbying on Microsoft's part).

Mac uses only a carriage return (CR, \r, 0x0D) for an end of line.

Conversion between the different formats are handled transparently in most editors, and can be done manually using the Unix2Dos and Dos2Unix utilities.

Technically, carriage return is an ASCII code to make the carriage (a dot-matrix printer's head) return to the beginning of the line, while line feed tells it to scroll one step down to the next line.