ANSI escape codes - click to copy - by alligator

copied!

cursor

\x1b[nA
cursor up
\x1b[nB
cursor down
\x1b[nC
cursor forward
\x1b[nD
cursor back
\x1b[nE
cursor next line
\x1b[nF
cursor prev line
\x1b[nG
cursor to col
\x1b[n;mH
cursor to pos

\x1b[0J
erase cursor to end of screen
\x1b[1J
erase cursor to start of screen
\x1b[2J
erase entire screen
\x1b[3J
erase entire screen + scrollback

\x1b[0K
erase cursor to end of line
\x1b[1K
erase cursor to start of line
\x1b[2K
erase entire line

\x1b[nS
scroll up
\x1b[nT
scroll down

colour

\x1b[0m
style reset
\x1b[31m
red fg
\x1b[32m
green fg
\x1b[33m
yellow fg
\x1b[34m
blue fg
\x1b[35m
magenta fg
\x1b[36m
cyan fg
\x1b[37m
white fg
\x1b[90m
gray fg
\x1b[91m
bright red fg
\x1b[92m
bright green fg
\x1b[93m
bright yellow fg
\x1b[94m
bright blue fg
\x1b[95m
bright magenta fg
\x1b[96m
bright cyan fg
\x1b[97m
bright white fg
\x1b[41m
red bg
\x1b[42m
green bg
\x1b[43m
yellow bg
\x1b[44m
blue bg
\x1b[45m
magenta bg
\x1b[46m
cyan bg
\x1b[47m
white bg
\x1b[100m
gray bg
\x1b[101m
bright red bg
\x1b[102m
bright green bg
\x1b[103m
bright yellow bg
\x1b[104m
bright blue bg
\x1b[105m
bright magenta bg
\x1b[106m
bright cyan bg
\x1b[107m
bright white bg

\x1b[38;5;nm
n = 256 colour fg
\x1b[48;5;nm
n = 256 colour bg

\x1b[38;2;r;g;bm
rgb fg
\x1b[48;2;r;g;bm
rgb bg

style

\x1b[1
bold
\x1b[2
dim
\x1b[3
italic
\x1b[4
underlined
\x1b[5
slow blink
\x1b[6
fast blink (rare)
\x1b[7
reverse video
\x1b[8
hide (rare)
\x1b[9
strike-thru (rare)
\x1b[20
𝔣𝔯𝔞𝔨𝔱𝔲𝔯 (𝔢𝔵𝔠𝔢𝔢𝔡𝔦𝔫𝔤𝔩𝔶 𝔯𝔞𝔯𝔢)