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 screenamโ automatic margins, which means automatic line wrapbsโ Ctrl+H (8 dec.) performs a backspacebwโ backspace on left margin wraps to previous line and right margindaโ display retained above screendbโ display retained below screeneoโ a space erases all characters at cursor positionesโ escape sequences and special characters work in status linegnโ generic devicehcโ this is a hardcopy terminalHCโ the cursor is hard to see when not on bottom linehsโ has a status linehzโ Hazeltine bug, the terminal can not print tilde charactersinโ terminal inserts null bytes, not spaces, to fill whitespacekmโ terminal has a meta keymiโ cursor movement works in insert modemsโ cursor movement works in standout/underline modeNPโ no pad characterNRโtidoes not reversetenxโ no padding, must use XON/XOFFosโ terminal can overstrikeulโ terminal underlines although it can not overstrikexbโ Beehive glitch,f1sends ESCAPE,f2sends^Cxnโ newline/wraparound glitchxoโ terminal uses xon/xoff protocolxsโ text typed over standout text will be displayed in standoutxtโ 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 columnsdBโ delay in milliseconds for backspace on hardcopy terminalsdCโ delay in milliseconds for carriage return on hardcopy terminalsdFโ delay in milliseconds for form feed on hardcopy terminalsdNโ delay in milliseconds for new line on hardcopy terminalsdTโ delay in milliseconds for tabulator stop on hardcopy terminalsdVโ delay in milliseconds for vertical tabulator stop on hardcopy terminalsitโ difference between tab positionslhโ height of soft labelslmโ lines of memorylwโ width of soft labelsliโ number of linesNlโ number of soft labelspbโ lowest baud rate which needs paddingsgโ standout glitchugโ underline glitchvtโ virtual terminal numberwsโ 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 keyalโ Insert one lineALโ Insert %1 linesacโ Pairs of block graphic characters to map alternate character setaeโ End alternative character setasโ Start alternative character set for block graphic charactersbcโ Backspace, if not ^Hblโ Audio bellbtโ Move to previous tab stopcbโ Clear from beginning of line to cursorccโ Dummy command charactercdโ Clear to end of screenceโ Clear to end of linechโ Move cursor horizontally only to column %1clโ Clear screen and cursor homecmโ Cursor move to row %1 and column %2 (on screen)CMโ Move cursor to row %1 and column %2 (in memory)crโ Carriage returncsโ Scroll region from line %1 to %2ctโ Clear tabscvโ Move cursor vertically only to line %1dcโ Delete one characterDCโ Delete %1 charactersdlโ Delete one lineDLโ Delete %1 linesdmโ Begin delete modedoโ Cursor down one lineDOโ Cursor down #1 linesdsโ Disable status lineeAโ Enable alternate character setecโ Erase %1 characters starting at cursoredโ End delete modeeiโ End insert modeffโ Formfeed character on hardcopy terminalsfsโ Return character to its position before going to status lineF1โ The string sent by function key f11F2โ The string sent by function key f12F3โ The string sent by function key f13...โ...F9โ The string sent by function key f19FAโ The string sent by function key f20FBโ The string sent by function key f21...โ...FZโ The string sent by function key f45Faโ The string sent by function key f46Fbโ The string sent by function key f47...โ...Frโ The string sent by function key f63hdโ Move cursor a half line downhoโ Cursor homehuโ Move cursor a half line upi1โ Initialization string 1 at logini3โ Initialization string 3 at loginisโ Initialization string 2 at loginicโ Insert one characterICโ Insert %1 charactersifโ Initialization fileimโ Begin insert modeipโ Insert pad time and needed special characters after insertiPโ Initialization programK1โ upper left key on keypadK2โ center key on keypadK3โ upper right key on keypadK4โ bottom left key on keypadK5โ bottom right key on keypadk0โ Function key 0k1โ Function key 1k2โ Function key 2k3โ Function key 3k4โ Function key 4k5โ Function key 5k6โ Function key 6k7โ Function key 7k8โ Function key 8k9โ Function key 9k;โ Function key 10kaโ Clear all tabs keykAโ Insert line keykbโ Backspace keykBโ Back tab stopkCโ Clear screen keykdโ Cursor down keykDโ Key for delete character under cursorkeโ turn keypad offkEโ Key for clear to end of linekFโ Key for scrolling forward/downkhโ Cursor home keykHโ Cursor hown down keykIโ Insert character/Insert mode keyklโ Cursor left keykLโ Key for delete linekMโ Key for exit insert modekNโ Key for next pagekPโ Key for previous pagekrโ Cursor right keykRโ Key for scrolling backward/upksโ Turn keypad onkSโ Clear to end of screen keyktโ Clear this tab keykTโ Set tab here keykuโ Cursor up keyl0โ Label of zeroth function key, if not f0l1โ Label of first function key, if not f1l2โ Label of first function key, if not f2...โ...laโ Label of tenth function key, if not f10leโ Cursor left one characterllโ Move cursor to lower left cornerLEโ Cursor left %1 charactersLFโ Turn soft labels offLOโ Turn soft labels onmbโ Start blinkingMCโ Clear soft marginsmdโ Start bold modemeโ End all mode like so, us, mb, md, and mrmhโ Start half bright modemkโ Dark mode (Characters invisible)MLโ Set left soft marginmmโ Put terminal in meta modemoโ Put terminal out of meta modempโ Turn on protected attributemrโ Start reverse modeMRโ Set right soft marginndโ Cursor right one characternwโ Carriage return commandpcโ Padding characterpfโ Turn printer offpkโ Program key %1 to send string %2 as if typed by userplโ Program key %1 to execute string %2 in local modepnโ Program soft label %1 to show string %2poโ Turn the printer onpOโ Turn the printer on for %1 (<256) bytespsโ Print screen contents on printerpxโ Program key %1 to send string %2 to computerr1โ Reset string 1 to set terminal to sane modesr2โ Reset string 2 to set terminal to sane modesr3โ Reset string 3 to set terminal to sane modesRAโ disable automatic marginsrcโ Restore saved cursor positionrfโ Reset string filenameRFโ Request for input from terminalRIโ Cursor right %1 charactersrpโ Repeat character %1 for %2 timesrPโ Padding after character sent in replace modersโ Reset stringRXโ Turn off XON/XOFF flow controlsaโ Set %1 %2 %3 %4 %5 %6 %7 %8 %9 attributesSAโ enable automatic marginsscโ Save cursor positionseโ End standout modesfโ Normal scroll one lineSFโ Normal scroll %1 linessoโ Start standout modesrโ Reverse scrollSRโ scroll back %1 linesstโ Set tabulator stop in all rows at current columnSXโ Turn on XON/XOFF flow controltaโ move to next hardware tabtcโ Read in terminal description from another entryteโ End program that uses cursor motiontiโ Begin program that uses cursor motiontsโ Move cursor to column %1 of status lineucโ Underline character under cursor and move cursor rightueโ End underliningupโ Cursor up one lineUPโ Cursor up %1 linesusโ Start underliningvbโ Visible bellveโ Normal cursor visibleviโ Cursor invisiblevsโ Standout cursorwiโ Set window from line %1 to %2 and column %3 to %4XFโ 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\xxxspecifies 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 output2โ Do ASCII output of this parameter with a field with of 2dโ 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 charsetaeโ end the alternative charsetacโ 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