Skip to main content
ansicode

CNL / CPL — Cursor next / previous line

Move the cursor to column 1 of the line N below (CNL) or above (CPL).

Byte forms

Every common string-literal form so you can paste-and-search either direction.

\\x1b[\x1b[NE (down N lines, col 1) \x1b[NF (up)
\\033[\033[E / \033[F
\\e[\e[E / \e[F
ESC [ESC [ N E / F
hex1b 5b <N> 45 / 46

Description

Final byte `E` = CNL (Cursor Next Line), `F` = CPL (Cursor Previous Line). Both move N rows (defaulting to 1 if omitted) AND reset the column to 1 — unlike CUU/CUD which preserve the column. Equivalent to a CRLF for `E` if you don't care about scroll-region semantics, but CNL respects scrolling regions and never auto-scrolls past the bottom of the region.

Spec citation: ECMA-48 §8.3.13 (CNL) / §8.3.27 (CPL)

Examples

bash
printf 'top\n\033[2Ebottom-of-3rd-line-below\n'
python
import sys; sys.stdout.write('\x1b[3E')
go
fmt.Print("\x1b[3E")
javascript
process.stdout.write('\x1b[3E')
c
printf("\x1b[3E");

Terminal support

xterm
yes
Linux console (fbcon)
yes
macOS Terminal.app
yes
iTerm2
yes
Windows Terminal
yes
cmd.exe / ConPTY
yes
kitty
yes
alacritty
yes
WezTerm
yes
Ghostty
yes
GNOME Terminal
yes
Konsole
yes
tmux
no
GNU screen
no

Related sequences

In the family cookbook

CSI cookbook · 2. Cursor movement — CUU / CUD / CUF / CUB + CUP + CHA / VPA