termcap(5)

๐Ÿ’– termcap(5) โ€” File Formats Manual ๐Ÿ’–

okay bestie, sit down, hydrate, because we're about to read the terminal capability database manual page together and honestly? it's giving vintage. this is termcap, from the File Formats Manual section. let's get into it ๐Ÿซถ


โœจ NAME โœจ

termcap โ€” terminal capability database ๐ŸŒˆ


๐ŸŒธ DESCRIPTION ๐ŸŒธ

so. the termcap database is an obsolete facility for describing the capabilities of character-cell terminals and printers. that's the tea, fr fr. it is retained only for compatibility with old programs. new programs should use the terminfo(5) database and its associated libraries. no cap. it's legacy, and we respect legacy, but we do not build new things on it ๐Ÿ’…

/etc/termcap is an ASCII file (the database master, the main character tbh ๐Ÿ‘‘) that lists the capabilities of many different types of terminals. programs can read termcap to find the particular escape codes needed to control the visual attributes of the terminal actually in use. (other aspects of the terminal are handled by stty(1), so don't come for termcap about those.) the termcap database is indexed on the TERM environment variable โœจ

termcap entries must be defined on a single logical line, with \ used to suppress the newline. fields are separated by :. the first field of each entry starts at the left-hand margin, and contains a list of names for the terminal, separated by |.

the first subfield may (in BSD termcap entries from 4.3BSD and earlier) contain a short name consisting of two characters. this short name may consist of capital or small letters. in 4.4BSD termcap entries this field is omitted ๐ŸŽ€

the second subfield (first, in the newer 4.4BSD format) contains the name used by the environment variable TERM. it should be spelled in lowercase letters. selectable hardware capabilities should be marked by appending a hyphen and a suffix to this name. see below for an example ๐Ÿ‘€ usual suffixes are w (more than 80 characters wide), am (automatic margins), nam (no automatic margins), and rv (reverse video display). the third subfield contains a long and descriptive name for this termcap entry ๐ŸŒธ

subsequent fields contain the terminal capabilities; any continued capability lines must be indented one tab from the left margin. one tab. not four spaces. i'm serious ๐Ÿ™ˆ

although there is no defined order, it is suggested to write first boolean, then numeric, and then string capabilities, each sorted alphabetically without looking at lower or upper spelling. capabilities of similar functions can be written in one line. it's a suggestion, not a vibe check you fail โ€” but it is the aesthetic ๐Ÿ’–

Example for:

Head line: vt|vt101|DEC VT 101 terminal in 80 character mode:\
Head line: Vt|vt101-w|DEC VT 101 terminal in (wide) 132 character mode:\
Boolean: :bs:\
Numeric: :co#80:\
String: :sr=\E[H:\

๐Ÿฆ‹ Boolean capabilities ๐Ÿฆ‹

these are the yes/no girlies. no value, just presence. here's every single one, no skipping โญ

  • 5i โ€” printer will not echo on screen
  • am โ€” automatic margins, which means automatic line wrap
  • bs โ€” Ctrl+H (8 dec.) performs a backspace
  • bw โ€” backspace on left margin wraps to previous line and right margin
  • da โ€” display retained above screen
  • db โ€” display retained below screen
  • eo โ€” a space erases all characters at cursor position
  • es โ€” escape sequences and special characters work in status line
  • gn โ€” generic device
  • hc โ€” this is a hardcopy terminal
  • HC โ€” the cursor is hard to see when not on bottom line
  • hs โ€” has a status line
  • hz โ€” Hazeltine bug, the terminal can not print tilde characters
  • in โ€” terminal inserts null bytes, not spaces, to fill whitespace
  • km โ€” terminal has a meta key
  • mi โ€” cursor movement works in insert mode
  • ms โ€” cursor movement works in standout/underline mode
  • NP โ€” no pad character
  • NR โ€” ti does not reverse te
  • nx โ€” no padding, must use XON/XOFF
  • os โ€” terminal can overstrike
  • ul โ€” terminal underlines although it can not overstrike
  • xb โ€” Beehive glitch, f1 sends ESCAPE, f2 sends ^C
  • xn โ€” newline/wraparound glitch
  • xo โ€” terminal uses xon/xoff protocol
  • xs โ€” text typed over standout text will be displayed in standout
  • xt โ€” Teleray glitch, destructive tabs and odd standout mode
bestie note: several of these are literally named after hardware bugs (Hazeltine, Beehive, Teleray). the 80s were wild and termcap is the receipts ๐Ÿ’€

๐ŸŽ€ Numeric capabilities ๐ŸŽ€

numbers, but make it terminal lore ๐Ÿ‘‘

  • co โ€” number of columns
  • dB โ€” delay in milliseconds for backspace on hardcopy terminals
  • dC โ€” delay in milliseconds for carriage return on hardcopy terminals
  • dF โ€” delay in milliseconds for form feed on hardcopy terminals
  • dN โ€” delay in milliseconds for new line on hardcopy terminals
  • dT โ€” delay in milliseconds for tabulator stop on hardcopy terminals
  • dV โ€” delay in milliseconds for vertical tabulator stop on hardcopy terminals
  • it โ€” difference between tab positions
  • lh โ€” height of soft labels
  • lm โ€” lines of memory
  • lw โ€” width of soft labels
  • li โ€” number of lines
  • Nl โ€” number of soft labels
  • pb โ€” lowest baud rate which needs padding
  • sg โ€” standout glitch
  • ug โ€” underline glitch
  • vt โ€” virtual terminal number
  • ws โ€” width of status line if different from screen width

and that's where we pause, because this page is long and there's more coming ๐Ÿ’œ don't go anywhere bestie โ€” there are more capabilities, more fields, and the whole rest of the drama still to come โœจ

๐Ÿ’– String capabilities ๐Ÿ’–

okay bestie, this is the big one โ€” every string capability a terminal can brag about. they're all listed as the two-char name plus what it does. slay.

  • !1 โ€” shifted save key
  • !2 โ€” shifted suspend key
  • !3 โ€” shifted undo key
  • #1 โ€” shifted help key
  • #2 โ€” shifted home key
  • #3 โ€” shifted input key
  • #4 โ€” shifted cursor left key
  • %0 โ€” redo key
  • %1 โ€” help key
  • %2 โ€” mark key
  • %3 โ€” message key
  • %4 โ€” move key
  • %5 โ€” next-object key
  • %6 โ€” open key
  • %7 โ€” options key
  • %8 โ€” previous-object key
  • %9 โ€” print key
  • %a โ€” shifted message key
  • %b โ€” shifted move key
  • %c โ€” shifted next key
  • %d โ€” shifted options key
  • %e โ€” shifted previous key
  • %f โ€” shifted print key
  • %g โ€” shifted redo key
  • %h โ€” shifted replace key
  • %i โ€” shifted cursor right key
  • %j โ€” shifted resume key
  • &0 โ€” shifted cancel key
  • &1 โ€” reference key
  • &2 โ€” refresh key
  • &3 โ€” replace key
  • &4 โ€” restart key
  • &5 โ€” resume key
  • &6 โ€” save key
  • &7 โ€” suspend key
  • &8 โ€” undo key
  • &9 โ€” shifted begin key
  • *0 โ€” shifted find key
  • *1 โ€” shifted command key
  • *2 โ€” shifted copy key
  • *3 โ€” shifted create key
  • *4 โ€” shifted delete character
  • *5 โ€” shifted delete line
  • *6 โ€” select key
  • *7 โ€” shifted end key
  • *8 โ€” shifted clear line key
  • *9 โ€” shifted exit key
  • @0 โ€” find key
  • @1 โ€” begin key
  • @2 โ€” cancel key
  • @3 โ€” close key
  • @4 โ€” command key
  • @5 โ€” copy key
  • @6 โ€” create key
  • @7 โ€” end key
  • @8 โ€” enter/send key
  • @9 โ€” exit key
  • al โ€” Insert one line
  • AL โ€” Insert %1 lines
  • ac โ€” Pairs of block graphic characters to map alternate character set
  • ae โ€” End alternative character set
  • as โ€” Start alternative character set for block graphic characters
  • bc โ€” Backspace, if not ^H
  • bl โ€” Audio bell
  • bt โ€” Move to previous tab stop
  • cb โ€” Clear from beginning of line to cursor
  • cc โ€” Dummy command character
  • cd โ€” Clear to end of screen
  • ce โ€” Clear to end of line
  • ch โ€” Move cursor horizontally only to column %1
  • cl โ€” Clear screen and cursor home
  • cm โ€” Cursor move to row %1 and column %2 (on screen)
  • CM โ€” Move cursor to row %1 and column %2 (in memory)
  • cr โ€” Carriage return
  • cs โ€” Scroll region from line %1 to %2
  • ct โ€” Clear tabs
  • cv โ€” Move cursor vertically only to line %1
  • dc โ€” Delete one character
  • DC โ€” Delete %1 characters
  • dl โ€” Delete one line
  • DL โ€” Delete %1 lines
  • dm โ€” Begin delete mode
  • do โ€” Cursor down one line
  • DO โ€” Cursor down #1 lines
  • ds โ€” Disable status line
  • eA โ€” Enable alternate character set
  • ec โ€” Erase %1 characters starting at cursor
  • ed โ€” End delete mode
  • ei โ€” End insert mode
  • ff โ€” Formfeed character on hardcopy terminals
  • fs โ€” Return character to its position before going to status line
  • F1 โ€” The string sent by function key f11
  • F2 โ€” The string sent by function key f12
  • F3 โ€” The string sent by function key f13
  • ... โ€” ...
  • F9 โ€” The string sent by function key f19
  • FA โ€” The string sent by function key f20
  • FB โ€” The string sent by function key f21
  • ... โ€” ...
  • FZ โ€” The string sent by function key f45
  • Fa โ€” The string sent by function key f46
  • Fb โ€” The string sent by function key f47
  • ... โ€” ...
  • Fr โ€” The string sent by function key f63
  • hd โ€” Move cursor a half line down
  • ho โ€” Cursor home
  • hu โ€” Move cursor a half line up
  • i1 โ€” Initialization string 1 at login
  • i3 โ€” Initialization string 3 at login
  • is โ€” Initialization string 2 at login
  • ic โ€” Insert one character
  • IC โ€” Insert %1 characters
  • if โ€” Initialization file
  • im โ€” Begin insert mode
  • ip โ€” Insert pad time and needed special characters after insert
  • iP โ€” Initialization program
  • K1 โ€” upper left key on keypad
  • K2 โ€” center key on keypad
  • K3 โ€” upper right key on keypad
  • K4 โ€” bottom left key on keypad
  • K5 โ€” bottom right key on keypad
  • k0 โ€” Function key 0
  • k1 โ€” Function key 1
  • k2 โ€” Function key 2
  • k3 โ€” Function key 3
  • k4 โ€” Function key 4
  • k5 โ€” Function key 5
  • k6 โ€” Function key 6
  • k7 โ€” Function key 7
  • k8 โ€” Function key 8
  • k9 โ€” Function key 9
  • k; โ€” Function key 10
  • ka โ€” Clear all tabs key
  • kA โ€” Insert line key
  • kb โ€” Backspace key
  • kB โ€” Back tab stop
  • kC โ€” Clear screen key
  • kd โ€” Cursor down key
  • kD โ€” Key for delete character under cursor
  • ke โ€” turn keypad off
  • kE โ€” Key for clear to end of line
  • kF โ€” Key for scrolling forward/down
  • kh โ€” Cursor home key
  • kH โ€” Cursor hown down key
  • kI โ€” Insert character/Insert mode key
  • kl โ€” Cursor left key
  • kL โ€” Key for delete line
  • kM โ€” Key for exit insert mode
  • kN โ€” Key for next page
  • kP โ€” Key for previous page
  • kr โ€” Cursor right key
  • kR โ€” Key for scrolling backward/up
  • ks โ€” Turn keypad on
  • kS โ€” Clear to end of screen key
  • kt โ€” Clear this tab key
  • kT โ€” Set tab here key
  • ku โ€” Cursor up key
  • l0 โ€” Label of zeroth function key, if not f0
  • l1 โ€” Label of first function key, if not f1
  • l2 โ€” Label of first function key, if not f2
  • ... โ€” ...
  • la โ€” Label of tenth function key, if not f10
  • le โ€” Cursor left one character
  • ll โ€” Move cursor to lower left corner
  • LE โ€” Cursor left %1 characters
  • LF โ€” Turn soft labels off
  • LO โ€” Turn soft labels on
  • mb โ€” Start blinking
  • MC โ€” Clear soft margins
  • md โ€” Start bold mode
  • me โ€” End all mode like so, us, mb, md, and mr
  • mh โ€” Start half bright mode
  • mk โ€” Dark mode (Characters invisible)
  • ML โ€” Set left soft margin
  • mm โ€” Put terminal in meta mode
  • mo โ€” Put terminal out of meta mode
  • mp โ€” Turn on protected attribute
  • mr โ€” Start reverse mode
  • MR โ€” Set right soft margin
  • nd โ€” Cursor right one character
  • nw โ€” Carriage return command
  • pc โ€” Padding character
  • pf โ€” Turn printer off
  • pk โ€” Program key %1 to send string %2 as if typed by user
  • pl โ€” Program key %1 to execute string %2 in local mode
  • pn โ€” Program soft label %1 to show string %2
  • po โ€” Turn the printer on
  • pO โ€” Turn the printer on for %1 (<256) bytes
  • ps โ€” Print screen contents on printer
  • px โ€” Program key %1 to send string %2 to computer
  • r1 โ€” Reset string 1 to set terminal to sane modes
  • r2 โ€” Reset string 2 to set terminal to sane modes
  • r3 โ€” Reset string 3 to set terminal to sane modes
  • RA โ€” disable automatic margins
  • rc โ€” Restore saved cursor position
  • rf โ€” Reset string filename
  • RF โ€” Request for input from terminal
  • RI โ€” Cursor right %1 characters
  • rp โ€” Repeat character %1 for %2 times
  • rP โ€” Padding after character sent in replace mode
  • rs โ€” Reset string
  • RX โ€” Turn off XON/XOFF flow control
  • sa โ€” Set %1 %2 %3 %4 %5 %6 %7 %8 %9 attributes
  • SA โ€” enable automatic margins
  • sc โ€” Save cursor position
  • se โ€” End standout mode
  • sf โ€” Normal scroll one line
  • SF โ€” Normal scroll %1 lines
  • so โ€” Start standout mode
  • sr โ€” Reverse scroll
  • SR โ€” scroll back %1 lines
  • st โ€” Set tabulator stop in all rows at current column
  • SX โ€” Turn on XON/XOFF flow control
  • ta โ€” move to next hardware tab
  • tc โ€” Read in terminal description from another entry
  • te โ€” End program that uses cursor motion
  • ti โ€” Begin program that uses cursor motion
  • ts โ€” Move cursor to column %1 of status line
  • uc โ€” Underline character under cursor and move cursor right
  • ue โ€” End underlining
  • up โ€” Cursor up one line
  • UP โ€” Cursor up %1 lines
  • us โ€” Start underlining
  • vb โ€” Visible bell
  • ve โ€” Normal cursor visible
  • vi โ€” Cursor invisible
  • vs โ€” Standout cursor
  • wi โ€” Set window from line %1 to %2 and column %3 to %4
  • XF โ€” XOFF character if not ^S

not me about to explain how you actually write those control codes ๐Ÿ‘€ there are several ways of defining them for string capabilities:

Every normal character represents itself, except '^', '\', and '%'.

A ^x means Control-x. Control-A equals 1 decimal.

\x means a special code. x can be one of the following characters:

  • E โ€” Escape (27)
  • n โ€” Linefeed (10)
  • r โ€” Carriage return (13)
  • t โ€” Tabulation (9)
  • b โ€” Backspace (8)
  • f โ€” Form feed (12)
  • 0 โ€” Null character. A \xxx specifies the octal character xxx.

and then for the parameter metacharacters, bestie:

  • i โ€” Increments parameters by one.
  • r โ€” Single parameter capability
  • + โ€” Add value of next character to this parameter and do binary output
  • 2 โ€” Do ASCII output of this parameter with a field with of 2
  • d โ€” Do ASCII output of this parameter with a field with of 3
  • % โ€” Print a '%'

If you use binary output, then you should avoid the null character ('\0') because it terminates the string. You should reset tabulator expansion if a tabulator can be the binary output of a parameter.

Warning: the above metacharacters for parameters may be wrong ๐Ÿ’€ they document Minix termcap which may not be compatible with Linux termcap. so likeโ€ฆ read it, but don't take it as gospel.

The block graphic characters? yeah you can specify those with three string capabilities:

  • as โ€” start the alternative charset
  • ae โ€” end the alternative charset
  • ac โ€” pairs of characters. The first character is the name of the block graphic symbol and the second characters is its definition. ๐ŸŽ€

The following names are available:

  • + โ€” right arrow (>)
  • , โ€” left arrow (<)
  • . โ€” down arrow (v)
  • 0 โ€” full square (#)
  • I โ€” lantern (#)
  • - โ€” upper arrow (^)
  • ' โ€” rhombus (+)
  • a โ€” chess board (:)
  • f โ€” degree (')
  • g โ€” plus-minus (#)
  • h โ€” square (#)
  • j โ€” right bottom corner (+)
  • k โ€” right upper corner (+)
  • l โ€” left upper corner (+)
  • m โ€” left bottom corner (+)
  • n โ€” cross (+)
  • o โ€” upper horizontal line (-)
  • q โ€” middle horizontal line (-)
  • s โ€” bottom horizontal line (_)
  • t โ€” left tee (+)
  • u โ€” right tee (+)
  • v โ€” bottom tee (+)
  • w โ€” normal tee (+)
  • x โ€” vertical line (|)
  • ~ โ€” paragraph (???)

The values in parentheses are suggested defaults which are used by the curses library, if the capabilities are missing. ๐Ÿซถ


๐ŸŒˆ SEE ALSO ๐ŸŒˆ


and that's the whole page, bestie!! this one came from Linux man-pages 6.20, dated 2025-09-21 โ€” so go forth and configure your terminals, you absolute icon ๐Ÿ‘‘โœจ๐Ÿ’…

๐Ÿ“ฆ where this page comes from
  • arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • ๐Ÿ“œ the page's license: GPL-2.0-or-later
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms