TERMINFO(5) | File Formats Manual | TERMINFO(5)

# NAME

terminfo — terminal capability definition

# DESCRIPTION

terminfo describes the capabilities of terminals, used by programs such as vi(1), rogue(6) and libraries such as curses(3). The terminfo source described here needs to be compiled with tic(1) to be of any use.

Entries in terminfo consist of a number of comma separated fields. White space after each comma is ignored. Embedded commas must be escaped by using a backslash. Lines beginning with ‘#' in the first column are treated as comments. Blank lines are ignored.

The header line must begin in column one and end with a comma. Inside the header line are terminal name and aliases, separated by vertical bars, the last one being the long description of the terminal.

Capability lines then follow, starting on column two and ending with a comma. Each capability is listed by its name, followed by its value if applicable. Booleans have no values, numeric values are prefixed by ‘#' and strings are prefixed by ‘='. Numbers can range from 0 to 32767 and string values can be up to 1000 characters long. This implementation supports strings upto 32767 characters long, including the NUL terminator.

Some escapes are available for strings - both \E and \e map to the ESC character, ^X maps to a control-X for any appropriate X, and the sequences \n, \r, \t, \b and \f map to linefeed, return, tab, backspace, and formfeed respectively. Any character can be escaped in octal, such as \072. If you need to encode a NUL character, it should be escaped as \200.

A delay in milliseconds may appear anywhere in a string capability, prefixed with a dollar sign and enclosed by angled brackets, such as $<5>.

## String Parameters

String capabilities sometimes require parameters. Normally this just involves replacing the parameter with a supplied variable; however, there are cases where the variable needs to be manipulated or used in conditional expressions. A stack is also provided for simple pop and push operations.

The below % encodings have the following meanings:

%%
  outputs %
%[[:]flags][width[.precision]][doxXs]
  flags are “[-+#]”. Prefix with ‘:' to avoid interpreting “%-” as an operator.
%c
  pop a parameter and print the character representation of it.
%s
  pop a parameter and print the string representation of it.
%p[1-9]
  push the parameter [1-9].
%P[a-z]
  pop a parameter and push it to dynamic variable [a-z].
%g[a-z]
  push the dynamic variable [a-z].
%P[A-Z]
  pop a parameter and push it to static variable [a-z].
%g[A-Z]
  push the dynamic variable [A-Z].

  Static variables persist over tparm() whereas dynamic variables do not.

%'c'
  char constant c.
%{nn}
  integer constant nn.
%l
  push the string length of the previously popped parameter.
%+ %- %* %/ %m
  arithmetic: pop two parameters and push the result.
%& %| %^
  bit operations: pop two parameters and push the result.
%! %~
  unary operations: pop two parameters and push the result.
%i
  add 1 to parameters 1 and 2.
%? expr %t then %e else %;
  If expr equates to zero then control passes to the optional else part.

## Boolean Capabilities

Long name | Code | TC
`auto_left_margin` | bw | bw
`auto_right_margin` | am | am
`back_color_erase` | bce | ut
`can_change` | ccc | cc
`ceol_standout_glitch` | xhp | xs
`col_addr_glitch` | xhpa | YA
`cpi_changes_res` | cpix | YF
`cr_cancels_micro_mode` | crxm | YB
`dest_tabs_magic_smso` | xt | xt
`eat_newline_glitch` | xenl | xn
`erase_overstrike` | eo | eo
`generic_type` | gn | gn
`hard_copy` | hc | hc
`hard_cursor` | chts | HC
`has_meta_key` | km | km
`has_print_wheel` | daisy | YC
`has_status_line` | hs | hs
`hue_light_saturation` | hls | hl
`insert_null_glitch` | in | in
`lpi_changes_yes` | lpix | YG
`memory_above` | da | da
`memory_below` | db | db
`move_insert_mode` | mir | mi
`move_standout_mode` | msgr | ms
`needs_xon_xoff` | nxon | nx
`no_esc_ctlc` | xsb | xb
`no_pad_char` | npc | NP
`non_dest_scroll_region` | ndscr | ND
`non_rev_rmcup` | nrrmc | NR
`over_strike` | os | os
`prtr_silent` | mc5i | 5i
`row_addr_glitch` | xvpa | YD
`semi_auto_right_margin` | sam | YE
`status_line_esc_ok` | eslok | es
`tilde_glitch` | hz | hz
`transparent_underline` | ul | ul
`xon_xoff` | xon | xo

## Numeric Capabilities

Long name | Code | TC
`bit_image_entwining` | bitwin | Yo
`bit_image_type` | bitype | Yp
`buffer_capacity` | bufsz | Ya
`buttons` | btns | BT
`columns` | cols | co
`dot_horz_spacing` | spinh | Yc
`dot_vert_spacing` | spinv | Yb
`init_tabs` | it | it
`label_height` | lh | lh
`label_width` | lw | lw
`lines` | lines | li
`lines_of_memory` | lm | lm
`magic_cookie_glitch` | xmc | sg
`max_attributes` | ma | ma
`max_colors` | colors | Co
`max_micro_address` | maddr | Yd
`max_micro_jump` | mjump | Ye
`max_pairs` | pairs | pa
`maximum_windows` | wnum | MW
`micro_col_size` | mcs | Yf
`micro_line_size` | mls | Yg
`no_color_video` | ncv | NC
`num_labels` | nlab | Nl
`number_of_pins` | npins | Yh
`output_res_char` | orc | Yi
`output_res_horz_inch` | orhi | Yk
`output_res_line` | orl | Yj
`output_res_vert_inch` | orvi | Yl
`padding_baud_rate` | pb | pb
`print_rate` | cps | Ym
`virtual_terminal` | vt | vt
`wide_char_size` | widcs | Yn
`width_status_line` | wsl | ws

## String Capabilities

Long name | Code | TC
`acs_chars` | acsc | ac
`alt_scancode_esc` | scesa | S8
`back_tab` | cbt | bt
`bell` | bel | bl
`bit_image_carriage_return` | bicr | Yv
`bit_image_newline` | binel | Zz
`bit_image_repeat` | birep | Xy
`carriage_return` | cr | cr
`change_char_pitch` | cpi | ZA
`change_line_pitch` | lpi | ZB
`change_res_horz` | chr | ZC
`change_res_vert` | cvr | ZD
`change_scroll_region` | csr | cs
`char_padding` | rmp | rP
`char_set_names` | csnm | Zy
`clear_all_tabs` | tbc | ct
`clear_margins` | mgc | MC
`clear_screen` | clear | cl
`clr_bol` | el1 | cb
`clr_eol` | el | ce
`clr_eos` | ed | cd
`code_set_init` | csin | ci
`color_names` | colornm | Yw
`column_address` | hpa | ch
`command_character` | cmdch | CC
`create_window` | cwin |
`cursor_address` | cup | cm
`cursor_down` | cud1 | do
`cursor_home` | home | ho
`cursor_invisible` | civis | vi
`cursor_left` | cub1 | le
`cursor_mem_address` | mrcup | CM
`cursor_normal` | cnorm | ve
`cursor_right` | cuf1 | nd
`cursor_to_ll` | ll | ll
`cursor_up` | cuu1 | up
`cursor_visible` | cvvis | vs
`define_bit_image_region` | defbi | Yx
`define_char` | defc | ZE
`delete_character` | dch1 | dc
`delete_line` | dl1 | dl
`device_type` | devt | dv
`dial_phone` | dial | DI
`dis_status_line` | dsl | ds
`display_clock` | dclk | DK
`display_pc_char` | dispc | S1
`down_half_time` | hd | hd
`ena_acs` | enacs | eA
`end_bit_image_region` | endbi | Yy
`enter_alt_charset_mode` | smacs | as
`enter_am_mode` | smam | SA
`enter_blink_mode` | blink | mb
`enter_bold_mode` | bold | md
`enter_ca_mode` | smcup | ti
`enter_delete_mode` | smdc | dm
`enter_dim_mode` | dim | mh
`enter_doublewide_mode` | swidm | ZF
`enter_draft_quality` | sdrfq | ZG
`enter_horizontal_hl_mode` | ehhlm | Xh
`enter_insert_mode` | smir | im
`enter_italics_mode` | sitm | ZH
`enter_left_hl_mode` | elhlm | Xl
`enter_leftward_mode` | slm | ZI
`enter_low_hl_mode` | elohlm | Xo
`enter_micro_mode` | smicm | ZJ
`enter_near_quality_letter` | snlq | ZK
`enter_normal_quality` | snrmq | ZL
`enter_pc_charset_mode` | smpch | S2
`enter_protected_mode` | prot | mp
`enter_reverse_mode` | rev | mr
`enter_right_hl_mode` | erhlm | Xr
`enter_scancode_mode` | smsc | S4
`enter_secure_mode` | invis | mk
`enter_shadow_mode` | sshm | ZM
`enter_standout_mode` | smso | so
`enter_subscript_mode` | ssubm | ZN
`enter_superscript_mode` | ssupm | ZO
`enter_top_hl_mode` | ethlm | Xt
`enter_underline_mode` | smul | us
`enter_upward_mode` | sum | ZP
`enter_vertical_hl_mode` | evhlm | Xv
`enter_xon_mode` | smxon | SX
`erase_chars` | ech | ec
`exit_alt_charset_mode` | rmacs | ae
`exit_am_mode` | rmam | RA
`exit_attribute_mode` | sgr0 | me
`exit_ca_mode` | rmcup | te
`exit_delete_mode` | rmdc | ed
`exit_doublewide_mode` | rwidm | ZQ
`exit_insert_mode` | rmir | ei
`exit_italics_mode` | ritm | ZR
`exit_leftward_mode` | rlm | ZS
`exit_micro_mode` | rmicm | ZT
`exit_pc_charset_mode` | rmpch | S3
`exit_scancode_mode` | rmsc | S5
`exit_shadow_mode` | rshm | ZU
`exit_standout_mode` | rmso | se
`exit_subscript_mode` | rsubm | ZV
`exit_superscript_mode` | rsupm | ZW
`exit_underline_mode` | rmul | ue
`exit_upward_mode` | rum | ZX
`exit_xon_mode` | rmxon | RX
`fixed_pause` | pause | PA
`flash_hook` | hook | fh
`flash_screen` | flash | vb
`form_feed` | ff | ff
`from_status_line` | fsl | fs
`get_mouse` | getm | Gm
`goto_window` | wingo | WG
`hangup` | hup | HU
`init_1string` | is1 | i1
`init_2string` | is2 | i2
`init_3string` | is3 | i3
`init_file` | if | if
`init_prog` | iprog | iP
`initialize_color` | initc | Ic
`initialize_pair` | initp | Ip
`insert_character` | ich1 | ic
`insert_line` | il1 | al
`insert_padding` | ip | ip
`key_a1` | ka1 | K1
`key_a3` | ka3 | K3
`key_b2` | kb2 | K2
`key_backspace` | kbs | kb
`key_beg` | kbeg | @1
`key_btab` | kcbt | kB
`key_c1` | kc1 | K4
`key_c3` | kc3 | K5
`key_cancel` | kcan | @2
`key_catab` | ktbc | ka
`key_clear` | kclr | kC
`key_close` | kclo | @3
`key_command` | kcmd | @4
`key_copy` | kcpy | @5
`key_create` | kcrt | @6
`key_ctab` | kctab | kt
`key_dc` | kdch1 | kD
`key_dl` | kdl1 | kL
`key_down` | kcud1 | kd
`key_eic` | krmir | kM
`key_end` | kend | @7
`key_enter` | kent | @8
`key_eol` | kel | kE
`key_eos` | ked | kS
`key_exit` | kext | @9
`key_f0` | kf0 | k0
`key_f1` | kf1 | k1
`key_f10` | kf10 | k;
`key_f11` | kf11 | F1
`key_f12` | kf12 | F2
`key_f13` | kf13 | F3
`key_f14` | kf14 | F4
`key_f15` | kf15 | F5
`key_f16` | kf16 | F6
`key_f17` | kf17 | F7
`key_f18` | kf18 | F8
`key_f19` | kf19 | F9
`key_f2` | kf2 | k2
`key_f20` | kf20 | FA
`key_f21` | kf21 | FB
`key_f22` | kf22 | FC
`key_f23` | kf23 | FD
`key_f24` | kf24 | FE
`key_f25` | kf25 | FF
`key_f26` | kf26 | FG
`key_f27` | kf27 | FH
`key_f28` | kf28 | FI
`key_f29` | kf29 | FJ
`key_f3` | kf3 | k3
`key_f30` | kf30 | FK
`key_f31` | kf31 | FL
`key_f32` | kf32 | FM
`key_f33` | kf33 | FN
`key_f34` | kf34 | FO
`key_f35` | kf35 | FP
`key_f36` | kf36 | FQ
`key_f37` | kf37 | FR
`key_f38` | kf38 | FS
`key_f39` | kf39 | FT
`key_f4` | kf4 | k4
`key_f40` | kf40 | FU
`key_f41` | kf41 | FV
`key_f42` | kf42 | FW
`key_f43` | kf43 | FX
`key_f44` | kf44 | FY
`key_f45` | kf45 | FZ
`key_f46` | kf46 | Fa
`key_f47` | kf47 | Fb
`key_f48` | kf48 | Fc
`key_f49` | kf49 | Fd
`key_f5` | kf5 | k5
`key_f50` | kf50 | Fe
`key_f51` | kf51 | Ff
`key_f52` | kf52 | Fg
`key_f53` | kf53 | Fh
`key_f54` | kf54 | Fi
`key_f55` | kf55 | Fj
`key_f56` | kf56 | Fk
`key_f57` | kf57 | Fl
`key_f58` | kf58 | Fm
`key_f59` | kf59 | Fn
`key_f6` | kf6 | k6
`key_f60` | kf60 | Fo
`key_f61` | kf61 | Fp
`key_f62` | kf62 | Fq
`key_f63` | kf63 | Fr
`key_f7` | kf7 | k7
`key_f8` | kf8 | k8
`key_f9` | kf9 | k9
`key_find` | kfnd | @0
`key_help` | khlp | %1
`key_home` | khome | kh
`key_ic` | kich1 | kI
`key_il` | kil1 | kA
`key_left` | kcub1 | kl
`key_ll` | kll | kH
`key_mark` | kmrk | %2
`key_message` | kmsg | %3
`key_mouse` | kmous | Km
`key_move` | kmov | %4
`key_next` | knxt | %5
`key_npage` | knp | kN
`key_open` | kopn | %6
`key_options` | kopt | %7
`key_ppage` | kpp | kP
`key_previous` | kprv | %8
`key_print` | kprt | %9
`key_redo` | krdo | %0
`key_reference` | kref | &1
`key_refresh` | krfr | &2
`key_replace` | krpl | &3
`key_restart` | krst | &4
`key_resume` | kres | &5
`key_right` | kcuf1 | kr
`key_save` | ksav | &6
`key_sbeg` | kBEG | &9
`key_scancel` | kCAN | &0
`key_scommand` | kCMD | *1
`key_scopy` | kCPY | *2
`key_screate` | kCRT | *3
`key_sdc` | kDC | *4
`key_sdl` | kDL | *5
`key_select` | kslt | *6
`key_send` | kEND | *7
`key_seol` | kEOL | *8
`key_sexit` | kEXT | *9
`key_sf` | kind | kF
`key_sfind` | kFND | *0
`key_shelp` | kHLP | #1
`key_shome` | kHOM | #2
`key_sic` | kIC | #3
`key_sleft` | kLFT | #4
`key_smessage` | kMSG | %a
`key_smove` | kMOV | %b
`key_snext` | kNXT | %c
`key_soptions` | kOPT | %d
`key_sprevious` | kPRV | %e
`key_sprint` | kPRT | %f
`key_sr` | kri | kR
`key_sredo` | kRDO | %g
`key_sreplace` | kRPL | %h
`key_sright` | kRIT | %i
`key_srsume` | kRES | %j
`key_ssave` | kSAV | !1
`key_ssuspend` | kSPD | !2
`key_stab` | khts | kT
`key_sundo` | kUND | !3
`key_suspend` | kspd | &7
`key_undo` | kund | &8
`key_up` | kcuu1 | ku
`keypad_local` | rmkx | ke
`keypad_xmit` | smkx | ks
`lab_f0` | lf0 | l0
`lab_f1` | lf1 | l1
`lab_f10` | lf10 | la
`lab_f2` | lf2 | l2
`lab_f3` | lf3 | l3
`lab_f4` | lf4 | l4
`lab_f5` | lf5 | l5
`lab_f6` | lf6 | l6
`lab_f7` | lf7 | l7
`lab_f8` | lf8 | l8
`lab_f9` | lf9 | l9
`label_format` | fln | Lf
`label_off` | rmln | LF
`label_on` | smln | LO
`meta_off` | rmm | mo
`meta_on` | smm | mm
`micro_column_address` | mhpa | ZY
`micro_down` | mcud1 | ZZ
`micro_left` | mcub1 | Za
`micro_right` | mcuf1 | Zb
`micro_row_address` | mvpa | Zc
`micro_up` | mcuu1 | Zd
`mouse_info` | minfo | Mi
`newline` | nel | nw
`order_of_pins` | porder | Ze
`orig_colors` | oc | oc
`orig_pair` | op | op
`pad_char` | pad | pc
`parm_dch` | dch | DC
`parm_delete_line` | dl | DL
`parm_down_cursor` | cud | DO
`parm_down_micro` | mcud | Zf
`parm_ich` | ich | IC
`parm_index` | indn | SF
`parm_insert_line` | il | AL
`parm_left_cursor` | cub | LE
`parm_left_micro` | mcub | Zg
`parm_right_cursor` | cuf | RI
`parm_right_micro` | mcuf | Zh
`parm_rindex` | rin | SR
`parm_up_cursor` | cuu | UP
`parm_up_micro` | mcuu | Zi
`pc_term_options` | pctrm | S6
`pkey_key` | pfkey | pk
`pkey_local` | pfloc | pl
`pkey_norm` | pln | pn
`pkey_plab` | pfxl | xl
`pkey_xmit` | pfx | px
`print_screen` | mc0 | ps
`ptr_non` | mc5p | pO
`ptr_off` | mc4 | pf
`ptr_on` | mc5 | po
`pulse` | pulse | PU
`quick_dial` | qdial | QD
`remove_clock` | rmclk | RC
`repeat_char` | rep | rp
`req_for_input` | rfi | RF
`req_mouse_pos` | reqmp | RQ
`reset_1string` | rs1 | r1
`reset_2string` | rs2 | r2
`reset_3string` | rs3 | r3
`reset_file` | rf | rf
`restore_cursor` | rc | rc
`row_address` | vpa | cv
`save_cursor` | sc | sc
`scancode_escape` | scesc | S7
`scroll_forward` | ind | sf
`scroll_reverse` | ri | sr
`select_char_set` | scs | Zj
`set0_des_seq` | s0ds | s0
`set1_des_seq` | s1ds | s1
`set2_des_seq` | s2ds | s2
`set3_des_seq` | s3ds | s3
`set_a_attributes` | sgr1 | sA
`set_a_background` | setab | AB
`set_a_foreground` | setaf | AF
`set_attributes` | sgr | sa
`set_background` | setb | Sb
`set_bottom_margin` | smgb | Zk
`set_bottom_margin_parm` | smgbp | Zl
`set_clock` | sclk | SC
`set_color_band` | setcolor |
`set_color_pair` | scp | sp
`set_foreground` | setf | Sf
`set_left_margin` | smgl | ML
`set_left_margin_parm` | smglp | Zm
`set_lr_margin` | smglr |
`set_page_length` | slines | Yz
`set_pglen_inch` | slength | sL
`set_right_margin` | smgr | MR
`set_right_margin_parm` | smgrp | Zn
`set_tab` | hts | st
`set_tb_margin` | smgtb | MT
`set_top_margin` | smgt | Zo
`set_top_margin_parm` | smgtp | Zp
`set_window` | wind | wi
`start_bit_image` | sbim | Zq
`start_char_set_def` | scsd | Zr
`stop_bit_image` | rbim | Zs
`stop_char_set_def` | rcsd | Zt
`subscript_characters` | subcs | Zu
`superscript_characters` | supcs | Zv
`tab` | ht | ta
`these_cause_cr` | docr | Zw
`to_status_line` | tsl | ts
`tone` | tone | TO
`underline_char` | uc | uc
`up_half_line` | hu | hu
`user0` | u0 | u0
`user1` | u1 | u1
`user2` | u2 | u2
`user3` | u3 | u3
`user4` | u4 | u4
`user5` | u5 | u5
`user6` | u6 | u6
`user7` | u7 | u7
`user8` | u8 | u8
`user9` | u9 | u9
`wait_tone` | wait | WA
`xoff_character` | xoffc | XF
`xon_character` | xonc | XN
`zero_motion` | zerom | Zx

## A Sample Entry

    vt100|dec vt100 (w/advanced video),
    am, xenl, msgr, mc5i, xon,
    cols#80, it#8, lines#24, vt#3,
    acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G,
    cr=^M, csr=\E[%i%p1%d;%p2%dr, tbc=\E[3g, clear=\E[H\E[J$<50>,
    el1=\E[1K$<3>, el=\E[K$<3>, ed=\E[J$<50>,
    cup=\E[%i%p1%d;%p2%dH$<5>, cud1=^J, home=\E[H, cub1=^H,
    cuf1=\E[C$<2>, cuu1=\E[A$<2>, enacs=\E(B\E)0, smacs=^N,
    smam=\E[?7h, blink=\E[5m$<2>, bold=\E[1m$<2>, rev=\E[7m$<2>,
    smso=\E[7m$<2>, smul=\E[4m$<2>, rmacs=^O, rmam=\E[?7l,
    sgr0=\E[m017$<2>, rmso=\E[m$<2>, rmul=\E[m$<2>, ka1=\EOq,
    ka3=\EOs, kb2=\EOr, kbs=^H, kc1=\EOp, kc3=\EOn, kcud1=\EOB,
    kent=\EOM, kf0=\EOy, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS,
    kf5=\EOt, kf6=\EOu, kf7=\EOv, kf8=\EOl, kf9=\EOw, kf10=\EOx,
    kcub1=\EOD, kcuf1=\EOC, kcuu1=\EOA, rmkx=\E[?1l\E>,
    smkx=\E[?1h\E=, lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4,
    cud=\E[%p1%dB, cub=\E[%p1%dD, cuf=\E[%p1%dC, cuu=\E[%p1%dA,
    mc0=\E[0i, mc4=\E[4i, mc5=\E[5i,
    rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, rc=\E8, sc=\E7,
    ind=^J, ri=\EM$<5>,
    sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t016%e017%;$<2>,
    hts=\EH, ht=^I,

## Fetching Compiled Descriptions

This implementation uses hashed databases managed by ndbm(3) instead of directories. To maintain compatability with other implementations, .db is appended to each file checked.

If the environment variable TERMINFO is available, does not begin with (‘/'), can be compiled with the above rules and whose name matches TERM then it is used.

If the environment variable TERMCAP is available and does not begin with a slash (‘/') then it will be translated into terminfo and compiled as above. If its name matches TERM then it is used.

If the environment variable TERMINFO is available and begins with a slash (‘/') then only this file is searched. Otherwise terminfo will first look for $HOME/.terminfo, followed by /usr/share/misc/terminfo unless TERMINFO_DIRS is available. If a matching description is not found then a small embedded database is searched, which currently holds descriptions for ansi, dumb, vt100, vt220, wsvt25, and xterm.

# FILES

$HOME/.terminfo.db
  Database of terminal descriptions for personal use.
/usr/share/misc/terminfo
  File containing terminal descriptions.
/usr/share/misc/terminfo.db
  Database of terminal descriptions.

# SEE ALSO

infocmp(1), tic(1), tput(1), curses(3), ndbm(3)

# STANDARDS

terminfo complies with the X/Open Curses Issue 4, Version 2 (“XCURSES4.2”) standard.

Extensions to the standard are noted in tic(1).

# AUTHORS

Roy Marples <roy@NetBSD.org>

March 10, 2011 | NetBSD 6.0