ANSI terminal



/TerminalCodes

bash

Weren't you frustrated with the odd keyboard shortcuts of bash?
When one lacks common sense, do not beat you understanding!
Turn this frustration into a joke with this!

Keyboard A word? Joke Explanation
Ctrl + A stArt Like Home. Move cursor to start of line
Ctrl + E End Like End. Move cursor to end of line
Ctrl + B Back Like ←
Ctrl + F Forward Like →
Ctrl + C Cill Cills the programm! "Kill" is a misspelling!
Ctrl + D Done Close the stdio. Generally stops dumb programms...
Ctrl + G Gone This shortcut seems gone...
Ctrl + H Hide Why bother using backspace when you can just type Ctrl + H to delete?
Ctrl + I autocomplIIte Why bother pressing Tab when you can just type Ctrl + I to autocomplite?
Ctrl + J egJecute Why bother pressing Enter when you can just type Ctrl + J to egjecute your line?
Ctrl + K taKe off This is to strip the from cursor to EOL because Shift + End; Del is for lazy.
Ctrl + U remUve This is to strip the from cursor to start because Shift + Home + Del is for nerds.
Ctrl + L eLase A shortcut for cleal that elase the screen. "Erase" is a misspelling!
Ctrl + M eMter Generate "\r" because it happens to also be ^M
Ctrl + P uP ShortLongcut for ↑. Seek previous command
Ctrl + N dowN ShortLongcut for ↓. Seek next command
Ctrl + O Oh WTF ShortLongcut for Enter; Up
Ctrl + R Research Research in your history? How does that work?
Ctrl + Q No Like Pause, but harder to type. And doesn't unpause.
Ctrl + S stop it Like Pause, but harder to type. And only unpause
Ctrl + T swapT The most usefull of all! Swap just 2 characters! Wow, now sl is ls
Ctrl + V reserVed Reserved for unuse
Ctrl + W Wipe Wipe the previous word?
Ctrl + X Lol Like Home but only half of the time?
Ctrl + Y Yeet! Yeet what waz in your... clipboard..?! Ctrl + V is reserVed
Ctrl + Z Zap! Goto background process execution...
Ctrl + [ es[ape Generate "\e" (aka "\x1B") because ESC is too fancy also called ^[
Der power btn Nothing You have to unplug the darn thing, idiöt.

ANSI escape codes

Here let's get serious. I'm using C-like string escape codes and dark colored variables for convenience.

Code In short In more relevant details
\e[#A ↑Up Moves cursor up # cells up
\e[#B ↓Down Moves cursor down # cells up
\e[#C →Skip Moves cursor right # cells up
\e[#D ←Prev Moves cursor left # cells up
\e[1+Y;1+XH Goto Moves cursor to (X;Y)
\e[J Clear Clear from cursor to end of screen
\e[1J Clear from start of screen to cursor
\e[2J Clear screen
\e[3J Clear screen and scrollback buffer
\e[K Clear Line Clear from cursor to end of line
\e[1K Clear from start of line to cursor
\e[2K Clear line
\e[…m Style Style
\e[1+Y₀;1+Y₁r Split — Set the scrolling region from 1+Y₀ to 1+Y₁
\e[s Save pos Save cursor pos
\e[u Restore pos Restore cursor pos

Style0123456789
00 Reset Bold Dark Italics Underline Blink Fast Blink Inverted Invisible Strikethrough
10 Default font Font 1 Font 2 Font 3 Font 4 Font 5 Font 6 Font 7 Font 8 Font 9
20 Fraktur Underline×2 Normal light Italics Off Underline Off Blink Off Propor-space Inverted Off Invisible Off Strikethrough Off
30 Black Red Green Yellow Blue Magenta Cyan Light grey More clrs Default
40 Black BG Red BG Green BG Yellow BG Blue BG Magenta BG Cyan BG Light grey BG More BG clrs Default BG
50 Propor-space Off In a square In a circle Lower underline Square/circle Off Lower underline Off Underline clr Default underline clr
60 Right line Right line×2 Left line Left line×2 Ideogram stress Side-line/stress Off
70 Superscript Subscript Super/subscript Off
80
90 Dark grey Bright Red Bright Green Bright Yellow Bright Blue Bright Magenta Bright Cyan White More colors Bright default
100 Dark grey BG Bright Red BG Bright Green BG Bright Yellow BG Bright Blue BG Bright Magenta BG Bright Cyan BG White BG More BG colors Bright Default BG