Skip to content
This repository has been archived by the owner on Dec 29, 2023. It is now read-only.

Terminal

tyfkda edited this page Jul 28, 2018 · 11 revisions

Escape sequence

ESC = 0x1b

  • Clear screen: ESC[2J
  • Move cursor to the top left: ESC[H
  • Get cursor position: ESC[6n => ESC[<col>;<row>R
    • You can try: echo -en '\033[6n'
  • Get terminal window size:
    • Use struct winsize ws; ioctl(1, TIOCGWINSZ, &ws) == 0, or
    • move cursor to far position (e.g. ESC[999CESC[999B), then get cursor position

Referece

termios

.

Clone this wiki locally