SCREEN(4)

✨ SCREEN(4) ✨

okay bestie, sit down, hydrate πŸ’– this is the manual page for screen β€” the pc display interface β€” straight out of the Kernel Interfaces Manual. Yes it's section 4. Yes it's about your virtual consoles. No it is not the screen(1) multiplexer, don't @ me πŸ’…


🌸 NAME 🌸

screen β€” pc display interface πŸ–₯️✨


πŸ¦‹ DESCRIPTION πŸ¦‹

So how do you even get to the virtual consoles? Through the device files, babe: /dev/ttyv0 all the way to /dev/ttyvb. Each one of those files is its own separate virtual console, its own lil universe 🌈

You can have all the virtual console devices open at once, but only one is active at a time β€” only one gets main character energy πŸ‘‘ The active virtual console "owns" the keyboard and the display screen. Periodt.

Now if you write output to a virtual console that isn't currently on the display, it is not lost, don't panic 😌 it gets saved in a buffer that holds a "screenfull" (normally 25) lines. And anything written to /dev/console (the original console device) is echoed to /dev/ttyv0. Cute, right?

πŸ”„ switching between consoles

To switch between the virtual consoles you use the sequence ALT+Fn β€” which means hold down ALT and press one of the function keys. The virtual console with the same number as that function key then gets selected as the current virtual console, and it gets exclusive use of the keyboard and display. Slay πŸ’…

This switch sequence can be changed via the keyboard mapping ioctl call β€” go read keyboard(4) if you wanna go deeper, iykyk.

πŸ”’ entering values that aren't physically on the keyboard

The console lets you enter values that aren't physically present on the keyboard through a special keysequence πŸ’« To use this: press and hold down ALT, then enter a decimal number from 0-255 via the numerical keypad, then release ALT. The entered value is then used as the ASCII value for one character. So yes bestie, you can enter any ASCII value this way. Iconic.

πŸ“œ the history function

The console driver also includes a history function, and it's activated by pressing the scroll-lock key. That holds the display and enables the cursor arrows for scrolling up and down through the last scrolled out lines. Time travel but make it terminal πŸ•°οΈβœ¨

🎨 character sequences

The console understands a subset of the ANSI x3.64 character sequences. And for compatibility with the old pccons, the PC3 character sequences are also supported. We love a backwards-compatible king 🫢


πŸ“‹ every sequence, no skips, we don't do that here

Format is: ANSI name Β· sequence β€” what it does β€” termcap entry. A -- means there isn't one, and that's valid too πŸ’–

  • -- Β· E7 β€” Save cursor position β€” termcap: sc
  • -- Β· E8 β€” Restore saved cursor position β€” termcap: rc
  • -- Β· Ec β€” Reset β€” termcap: rs
  • -- Β· EM β€” move cursor up 1 line, scroll if at top β€” termcap: --
  • CUU Β· E[nA β€” move cursor up n lines β€” termcap: up/UP (ku)
  • CUD Β· E[nB β€” move cursor down n lines β€” termcap: do/DO (kd)
  • CUF Β· E[nC β€” move cursor right n characters β€” termcap: nd/RI (kr)
  • CUB Β· E[nD β€” move cursor left n characters β€” termcap: --/LE (kl)
  • HPA Β· E[n` β€” move cursor to character position n β€” termcap: ch
  • HPR Β· E[na β€” move cursor right n characters β€” termcap: --
  • VPA Β· E[nd β€” move cursor to line n β€” termcap: cv
  • VPR Β· E[ne β€” move cursor down n lines β€” termcap: --
  • CPL Β· E[nF β€” move cursor to start of line, n lines up β€” termcap: -- (@7)
  • CNL Β· E[nE β€” move cursor to start of line, n lines down β€” termcap: nw
  • CUP Β· E[y;xH β€” Move cursor to x, y β€” termcap: cm
  • HVP Β· E[y;xf β€” Move cursor to x, y β€” termcap: --
  • CBT Β· E[nZ β€” Move cursor back n tab stops β€” termcap: bt (kB)
  • IL Β· E[nL β€” Insert n blank lines β€” termcap: al/AL
  • ICH Β· E[n@ β€” Insert n blank characters β€” termcap: ic/IC
  • DL Β· E[nM β€” Delete n lines β€” termcap: dl/DL
  • DCH Β· E[nP β€” Delete n characters β€” termcap: dc/DC
  • ED Β· E[nJ β€” Erase part or all of display β€” termcap: cd
    • n=0 from cursor to end of display
    • n=1 from begin of display to cursor
    • n=2 entire display
  • EL Β· E[nK β€” Erase part or all of line β€” termcap: ce
    • n=0 from cursor to end of line
    • n=1 from begin of line to cursor
    • n=2 entire line
  • ECH Β· E[nX β€” Erase n characters β€” termcap: ec
  • SU Β· E[nS β€” Scroll display n lines up (forward) β€” termcap: sf/SF
  • SD Β· E[nT β€” Scroll display n lines down (reverse) β€” termcap: sr/SR
  • SGR Β· E[nm β€” Set character attributes β€” termcap: --
    • n= 0 normal attribute (all off)
    • n= 1 bold (highlight)
    • n= 4 underscore (if supported by HW)
    • n= 5 blink (if supported by HW)
    • n= 7 reverse
    • n= 22 remove bold
    • n= 24 remove underscore
    • n= 25 remove blink
    • n= 27 remove reverse
    • n= 3X set ANSI foreground color (see table)
    • n= 4X set ANSI background color (see table)
    • the color table, in order:
      • X=0 black Β· X=1 red
      • X=2 green Β· X=3 brown
      • X=4 blue Β· X=5 magenta
      • X=6 cyan Β· X=7 light grey
      • X=9 reset to the normal color
  • -- Β· E[s β€” Save cursor position β€” termcap: sc
  • -- Β· E[u β€” Restore saved cursor position β€” termcap: rc
  • -- Β· E[x β€” Reset normal colors and attributes to their default values β€” termcap: --
  • -- Β· E[nz β€” Switch to virtual console n β€” termcap: --
  • -- Β· E[1;nx β€” Set normal ANSI background color to n (see table) β€” termcap: --
  • -- Β· E[2;nx β€” Set normal ANSI foreground color to n (see table) β€” termcap: --
  • -- Β· E[3;nx β€” Set normal video attribute directly to n (n from 0 to 255) β€” termcap: --
  • -- Β· E[5;nx β€” Set normal ANSI reverse background color to n (see table) β€” termcap: --
  • -- Β· E[6;nx β€” Set normal ANSI reverse foreground color to n (see table) β€” termcap: --
    • the color table for all of the above, in order:
      • n= 0 black Β· n= 8 dark grey
      • n= 1 red Β· n= 9 light red
      • n= 2 green Β· n=10 light green
      • n= 3 brown Β· n=11 yellow
      • n= 4 blue Β· n=12 light blue
      • n= 5 magenta Β· n=13 light magenta
      • n= 6 cyan Β· n=14 light cyan
      • n= 7 light grey Β· n=15 white
  • -- Β· E[7;nx β€” Set normal reverse video attribute directly to n (n from 0 to 255) β€” termcap: --
  • -- Β· E[=p;dB β€” Set bell pitch (p) and duration (d) β€” termcap: --
    • pitch is in units of 840 nS
    • duration is units of 0,1 S
  • -- Β· E[=tC β€” Set global cursor type (see table) β€” termcap: --
    • t=0 normal non-blinking
    • t=1 normal blinking
    • t=2 custom non-blinking
    • t=3 custom blinking
    • t=4 reset cursor (resets custom cursor shape and sets current cursor type to 0)
    • t=5 hide cursor
  • -- Β· E[=s;eC β€” Set custom cursor shape, where s is the starting and e is the ending scanlines of the cursor β€” termcap: --
  • -- Β· E[=s;e;dC β€” Same as above, except d specifies the direction β€” termcap: --
    • if 0, scanlines are counted from the top to the bottom
    • if 1, from the bottom to the top
  • -- Β· E[=tS β€” Set local cursor type (see table) β€” termcap: --
    • t=0 normal (global) β€” termcap: ve
    • t=1 invisible β€” termcap: vi
    • t=2 very visible β€” termcap: vs
  • -- Β· E[=nA β€” Set the border color to n (see table) (if supported by HW) β€” termcap: --
  • -- Β· E[=nF β€” Set normal foreground color to n (see table) β€” termcap: --
  • -- Β· E[=nG β€” Set normal background color to n (see table) β€” termcap: --
  • -- Β· E[=nH β€” Set normal reverse foreground color to n (see table) β€” termcap: --
  • -- Β· E[=nI β€” Set normal reverse background color to n (see table) β€” termcap: --
    • the color table for the E[=nA / E[=nF / E[=nG / E[=nH / E[=nI crew, in order:
      • n= 0 black Β· n= 8 dark grey
      • n= 1 blue Β· n= 9 light blue
      • n= 2 green Β· n=10 light green
      • n= 3 cyan Β· n=11 light cyan
      • n= 4 red Β· n=12 light red
      • n= 5 magenta Β· n=13 light magenta
      • n= 6 brown Β· n=14 yellow
      • n= 7 light grey Β· n=15 white
note: the first E in the sequences stands for ESC (0x1b) πŸ‘€ do not forget her, she is doing so much work

πŸ‘‘ AUTHORS πŸ‘‘

SΓΈren Schmidt <sos@FreeBSD.org> β€” the icon who wrote all this πŸ’–


and that's the whole page bestie 🫢 this one came from Debian, dated October 6, 2000 (yes, a vintage ✨), and it lives in section SCREEN(4). go forth and switch consoles responsibly πŸŒˆπŸ’…

πŸ“¦ where this page comes from