About LF


Integer ASCII code: 10
Binary code: 0000 1010
Octal code: 12
Hexadecimal code: 0A
Group: control
Seq: ^J
C/C++ notation: \n or '\n'

Unicode symbol: , int code: 9226 (html &#9226) hex code: 240A (html &#x240A)


Information


On typewriters, printers, and some terminal emulators, line feed has a function of moving the cursor down one row without producing any effect on its column position. On Unix it is used to mark end-of-line. In DOS, Windows, and different network standards, line feed is used following CR as part of the end-of-line mark.

Newline (often called line ending, end of line (EOL), line feed, or line break) is a control character or sequence of control characters in a character encoding specification (e.g. ASCII or EBCDIC). It is used in function of symbolizing the end of a line of text and the following start of a new one. This special character is set by text editors with the help of Enter key.

When showing (or printing) a text file, this control character makes the text editor to show the following characters in a new line.

History


In the mid-1800s, Morse code operators invented and used Morse code prosigns in order to encode white space text formatting in formal written text messages. This happened long before the creation and usage of teleprinters and teletype machines. Especially, the Morse prosign was represented by the adhesion of two literal textual Morse code "A" characters. They were sent without the usual inter-character spacing, which was used in Morse code in order to encode and indicate a new line in a formal text message.

Now let's move further. Some time later, when the modern teleprinters were created and standardized, character set control codes were developed just to provide help in white space text formatting. ASCII was developed by the International Organization for Standardization (ISO) and the American Standards Association (ASA) at a time. The American Standards Association (ASA) was actually the predecessor organization to American National Standards Institute (ANSI). The period of 1963 to 1968 was a significant one, because it was the time when ISO draft standards supported the use of CR+LF or LF alone as a newline. However, the ASA drafts supported only CR+LF.

The CR+LF sequence was commonly used on many early computer systems that had adopted Teletype machines. A Teletype Model 33 ASR was an outstanding console device, because this sequence was required to position those printers at the start of a new line. The split of newline into two functions, however, hid the fact that if the print head was far away, it could not return to the beginning of the next line in one-character time. That is the reason of why the sequence was always sent with the CR first. A character printed after a CR would often print not correctly, leaving an unplanned and pretty unpleasant blot in the middle of the page, while it was still moving the carriage back to the first position. The solution was to make the newline with the help of two characters: CR to move the carriage to column one, and LF to move the paper upwards. Actually there was often a necessity in sending extra characters (unnecessary CRs or NULs, which are ignored) to give the print head some time to move to the left margin. Even many video displays of past time needed multiple character times in order to scroll the display.

These systems were arranged the way, which required text to be constantly arranged in order to be compatible with these printers. The key was that the concept of device drivers, concealing such hardware details from the application, was not yet well developed. This way, applications had to talk directly to the Teletype machine and follow its conventions. Lots of minicomputer systems from DEC used this convention. CP/M used it too in order to print on the same terminals that minicomputers used. That was the time, when MS-DOS (1981) adopted CP/M's CR+LF in order to be compatible. This convention was taken over by Microsoft's later Windows operating system.

In 1964 Multics operating system began development. LF played a role of its newline, so LF was used alone. Multics used a device driver in order to reformulate this character to any sequence that a printer required (including extra padding characters), and the single byte was more convenient for programming. Nowadays we think that there was much more easy and obvious choice of CR, however, it was not used. The reason is the following: a simple CR provided the helpful function of overprinting one line with another. With the help of it some boldfaces and strikethrough effects could be created, thus it was useful to not translate it. There is one fact that is actually the most important one: the use of LF alone as a line terminator had already been incorporated into drafts of the final ISO/IEC 646 standard. Unix did the same what Multics did, and later Unix-like systems followed Unix.

Representation


People closely associate ideas concepts of line feed (LF) and carriage return (CR). They can be considered either separately or together. If we're talking about the physical media of typewriters and printers, two axes of motion, "down" and "across", are necessary here in order to create a new line on the page. Despite the fact, that the design of a machine (typewriter or printer) must consider them separately, the mechanical logic of software can unite them together as one thing. This is the reason why a newline in character encoding can be defined as LF and CR united into one (usually called CR+LF or CRLF).

Some sets of character have an individual newline character code. Let's see the example. EBCDIC has an NL character code in addition to the existing CR and LF codes. Unicode also supports a "next line" (NEL) control code and some control codes for "line separator" and "paragraph separator" markers in addition to providing the ASCII CR and LF control codes.


Hash


input value base type output hash
LF char MD5 68b329da9893e34099c7d8ad5cb9c940
LF char SHA1 adc83b19e793491b1c6ea0fd8b46cd9f32e592fc
10 dec MD5 d3d9446802a44259755d38e6d163e820
10 dec SHA1 b1d5781111d84f7b3fe45a0852e59758cd7a87e5
00001010 bin MD5 96da9783406f8319c3430eadbec0657a
00001010 bin SHA1 487a252926d6285a3fc9d7b7005107ee110289c7
0000 1010 bin MD5 8fff37afaa968c5bf1f04a6086ec61ad
0000 1010 bin SHA1 73656acfa1d8270852f08513f6fda44049de614e
12 oct MD5 c20ad4d76fe97759aa27a0c99bff6710
12 oct SHA1 7b52009b64fd0a2a49e6d8a939753077792b0554
0A hex MD5 3ee74005e9165bac449dcbe722951ce0
0A hex SHA1 d45c3e58ea20c7d118dad4c1dc03811cce8dc39b
0x0A hex MD5 203809897978968515f4ce00fcbb035d
0x0A hex SHA1 35d9fb27f0789e03e56dcdc67643ae51b66c1d82
Back to ASCII table

 2018 © Dmytro Koshovyi. Ukraine, Mykolayiv.