Skip to main content

LF

AI-Generated Content
This page was generated with the assistance of AI and may contain inaccuracies. It is intended as a placeholder for future human verification. If you spot issues ahead of its initial review, please report them on GitHub!
Standard

LF (Line Feed) is a C0 control character that moves the cursor down one line. It is the standard line terminator on Unix systems and one of the most frequently encountered control characters.

Syntax​

LF        0x0A
Formal syntax
LF = 0x0a ;

Description​

Per ECMA-48 §8.3.74, LF "causes the active presentation position to be moved to the corresponding character position of the following line in the presentation component."

In default operation, LF moves the cursor down one line while remaining in the same column. If the cursor is at the bottom of the scrolling region (set by DECSTBM), the display scrolls up.

LNM mode interaction​

When the Line Feed/New Line Mode (LNM, DECSET mode 20) is set, LF additionally performs a carriage return, moving the cursor to column 1 of the next line. In the default (reset) state, LF only moves down.

VT/FF​

The Vertical Tab (VT, 0x0B) and Form Feed (FF, 0x0C) characters are treated identically to LF by virtually all terminal emulators.

Unix line endings​

Unix systems use LF alone as the line terminator. The terminal driver's output processing (specifically the onlcr flag) translates LF to CR+LF on output so that lines start at column 1. When the terminal is in raw mode, this translation is disabled and LF only moves the cursor down.

Examples​

printf 'Line 1\nLine 2'   # \n is LF — move to next line

Specifications​

SpecificationSection
ECMA-48§8.3.74

Terminal support​

TerminalSupportVersionNotes
Terminal Emulators
Alacritty✓YesHandler linefeed() at term/mod.rs:1423
Bobcat✓0.9.0Basic C0 control, handled in TerminalCtrl library
contour✓v0.1.0Implemented in executeControlCode; calls linefeed()
foot✓YesImplemented in vt.c:227-234, also handles VT and FF
Ghostty✓v1.0.0LF, VT, and FF all trigger linefeed in stream.zig:770
iTerm2✓Yes
Kitty✓Yes
Konsole✓Yes
mintty✓YesHandled in do_ctrl() at src/termout.c:1705-1708
mlterm✓rel-0_2_1
PuTTY✓0.45
Rio✓v0.0.28
rxvt-unicode✓rxvt-unicode-1.2
st✓0.6
terminology✓v0.1.0
VT100✓Yes
VTE✓Yes
WezTerm✓YesHandled in performer.rs:380 via ControlCode::LineFeed, also handles VerticalTab and FormFeed identically
Windows Terminal✓YesLF, FF, and VT are identical in function (OutputStateMachineEngine.cpp:68-72)
xterm✓YesImplemented in charproc.c:3732 as CASE_VMOT. Handles LF, VT, and FF
xterm.js✓2.3.0
Multiplexers
cy✓v0.1.0
GNU Screen✓v.4.2.0Implemented in Special() function at src/ansi.c:684-689
tmux✓0.8Also handles VT and FF; respects CRLF mode
tuios✓v0.0.15
Zellij✓v0.5.0-beta

See also​