In computing, a newline, also known as a line ending, end of line (EOL), or line break, is a special character or sequence of characters signifying the end of a line of text and the start of a new line.
The concepts of
line feed (LF) and
carriage return (CR) are closely associated, and can be either considered separately together.
The line feed indicates that one line of paper should feed out of the printer thus instructed the printer to advance the paper one line, and a carriage return indicated that the printer carriage should return to the beginning of the current line.
Line Feed(LF)is represented as
0x0Ain hexadecimal and
Carriage Return(CR)is represented as
0x0Din hexadecimal and
The actual codes representing a newline vary across operating systems, which can be a problem when exchanging text files between systems with different newline representations.
- Windows, and DOS before it, uses a pair of CR and LF characters to terminate lines (
- UNIX (Including Linux and FreeBSD) uses an LF character only (
- OSX also uses a single LF character(
0x0A), but the classic Mac operating system used a single CR character for line breaks(
Removing CRs on Linux and BSD based OS that haven’t GNU extensions.
Adding CRs on Linux and BSD based OS that haven’t GNU extensions.