neulab/tldr huggingface dataset:
FormFeed a form feed will be sent at the end of the last line printed (i.e., printerFormFeed is “true”).
noNewLine no newline will be sent at the end of the last line printed, and wrapped lines will be combined into long lines (i.e., printerNewLine is “false”).
NewLine a newline will be sent at the end of the last line printed, and each line will be limited (by adding a newline) to the screen width (i.e., printerNewLine is “true”).
noAttrs the page is printed without attributes (i.e., printAttributes is “0”).
monoAttrs the page is printed with monochrome (vt220) attributes (i.e., printAttributes is “1”).
colorAttrs the page is printed with ANSI color attributes (i.e., printAttributes is “2”).
print-everything(printer-flags) This action sends the entire text history, in addition to the text currently visible, to the program given in the printerCommand resource.  It allows the same optional parameters as the print action.  With a suitable printer command, the action can be used to load the text history in an editor.
print-immediate() Sends the text of the current window directly to a file, as specified by the printFileImmediate, printModeImmediate and printOptsImmediate resources.
print-on-error() Toggles a flag telling xterm that if it exits with an X error, to send the text of the current window directly to a file, as specified by the printFileOnXError, printModeOnXError and printOptsOnXError resources.
print-redir() This action toggles the printerControlMode between 0 and 2.  The corresponding popup menu entry is useful for switching the printer off if you happen to change your mind after deciding to print random binary files on the terminal.
quit() This action sends a SIGHUP to the subprogram and exits.  It is also invoked by the quit entry in mainMenu.
readline-button() Supports the optional readline feature by echoing repeated cursor forward or backward control sequences on button release event, to request that the host application update its notion of the cursor's position to match the button event.
redraw() This action redraws the window.  It is also invoked by the redraw entry in mainMenu.
restore() Restores the window to the size before it was last maximized.
scroll-back(count [,units [,mouse] ]) This action scrolls the text window backward so that text that had previously scrolled off the top of the screen is now visible.
The count argument indicates the number of units (which may be page, halfpage, pixel, or line) by which to scroll.  If no count parameter is given, xterm uses the number of lines given by the scrollLines resource.
An adjustment can be specified for the page or halfpage units by appending a “+” or “-” sign followed by a number, e.g., page-2 to specify 2 lines less than a page.
If the second parameter is omitted “lines” is used.
If the third parameter mouse is given, the action is ignored when mouse reporting is enabled.
scroll-forw(count [,units [,mouse] ]) This action is similar to scroll-back except that it scrolls in the other direction.
scroll-lock(on/off/toggle) This action sets, unsets or toggles internal state which tells xterm whether Scroll Lock is active, subject to the allowScrollLock resource.
scroll-to(count) Scroll to the given line relative to the beginning of the saved- lines.  For instance, “scroll-to(0)” would scroll to the beginning.  Two special nonnumeric parameters are recognized:
scroll-to(begin) Scroll to the beginning of the saved lines.
scroll-to(end) Scroll to the end of the saved lines, i.e., to the currently active page.
secure() This action toggles the Secure Keyboard mode (see SECURITY), and is invoked from the securekbd entry in mainMenu.
select-cursor-end(destname [, ...]) This action is similar to select-end except that it should be used with select-cursor-start.
select-cursor-extend() This action is similar to select-extend except that it should be used with select-cursor-start.
select-cursor-start() This action is similar to select-start except that it begins the selection at the current text cursor position.
select-end(destname [, ...]) This action puts the currently selected text into all of the selections or cutbuffers specified by destname.  It also sends a mouse position and updates the internal selection state to reflect the end of the selection process.
select-extend() This action tracks the pointer and extends the selection.  It should only be bound to Motion events.
select-set() This action stores text that corresponds to the current selection, without affecting the selection mode.
select-start() This action begins text selection at the current pointer location.  See the section on POINTER USAGE for information on making selections.
send-signal(signame) This action sends the signal named by signame to the xterm subprocess (the shell or program specified with the -e command line option).  It is also invoked by the suspend, continue, interrupt, hangup, terminate, and kill entries in mainMenu. Allowable signal names are (case is not significant): tstp (if supported by the operating system), suspend (same as tstp), cont (if supported by the operating system), int, hup, term, quit, alrm, alarm (same as alrm) and kill.
set-8-bit-control(on/off/toggle) This action sets, unsets or toggles the eightBitControl resource. It is also invoked from the 8-bit-control entry in vtMenu.
set-allow132(on/off/toggle) This action sets, unsets or toggles the c132 resource.  It is also invoked from the allow132 entry in vtMenu.
set-altscreen(on/off/toggle) This action sets, unsets or toggles between the alternate and current screens.
set-appcursor(on/off/toggle) This action sets, unsets or toggles the handling Application Cursor Key mode and is also invoked by the appcursor entry in vtMenu.
set-appkeypad(on/off/toggle) This action sets, unsets or toggles the handling of Application Keypad mode and is also invoked by the appkeypad entry in vtMenu.
set-autolinefeed(on/off/toggle) This action sets, unsets or toggles automatic insertion of line feeds.  It is also invoked by the autolinefeed entry in vtMenu.
set-autowrap(on/off/toggle) This action sets, unsets or toggles automatic wrapping of long lines.  It is also invoked by the autowrap entry in vtMenu.
set-backarrow(on/off/toggle) This action sets, unsets or toggles the backarrowKey resource. It is also invoked from the backarrow key entry in vtMenu.
set-bellIsUrgent(on/off/toggle) This action sets, unsets or toggles the bellIsUrgent resource. It is also invoked by the bellIsUrgent entry in vtMenu.
set-cursesemul(on/off/toggle) This action sets, unsets or toggles the curses resource.  It is also invoked from the cursesemul entry in vtMenu.
set-cursorblink(on/off/toggle) This action sets, unsets or toggles the cursorBlink resource.  It is also invoked from the cursorblink entry in vtMenu.
set-font-doublesize(on/off/toggle) This action sets, unsets or toggles the fontDoublesize resource. It is also invoked by the font-doublesize entry in fontMenu.
set-font-linedrawing(on/off/toggle) This action sets, unsets or toggles the xterm's state regarding whether the current font has line-drawing characters and whether it should draw them directly.  It is also invoked by the font-linedrawing entry in fontMenu.
set-font-packed(on/off/toggle) This action sets, unsets or toggles the forcePackedFont resource which controls use of the font's minimum or maximum glyph width. It is also invoked by the font-packed entry in fontMenu.
set-hp-function-keys(on/off/toggle) This action sets, unsets or toggles the hpFunctionKeys resource. It is also invoked by the hpFunctionKeys entry in mainMenu.
set-jumpscroll(on/off/toggle) This action sets, unsets or toggles the jumpscroll resource.  It is also invoked by the jumpscroll entry in vtMenu.
set-keep-clipboard(on/off/toggle) This action sets, unsets or toggles the keepClipboard resource.
set-keep-selection(on/off/toggle) This action sets, unsets or toggles the keepSelection resource. It is also invoked by the keepSelection entry in vtMenu.
set-logging(on/off/toggle) This action sets, unsets or toggles the state of the logging option.
set-marginbell(on/off/toggle) This action sets, unsets or toggles the marginBell resource.
set-num-lock(on/off/toggle) This action toggles the state of the numLock resource.
set-old-function-keys(on/off/toggle) This action sets, unsets or toggles the state of legacy function keys.  It is also invoked by the oldFunctionKeys entry in mainMenu.
set-pop-on-bell(on/off/toggle) This action sets, unsets or toggles the popOnBell resource.  It is also invoked by the poponbell entry in vtMenu.
set-private-colors(on/off/toggle) This action sets, unsets or toggles the privateColorRegisters resource.
set-render-font(on/off/toggle) This action sets, unsets or toggles the renderFont resource.  It is also invoked by the render-font entry in fontMenu.
set-reverse-video(on/off/toggle) This action sets, unsets or toggles the reverseVideo resource. It is also invoked by the reversevideo entry in vtMenu.
set-reversewrap(on/off/toggle) This action sets, unsets or toggles the reverseWrap resource.  It is also invoked by the reversewrap entry in vtMenu.
set-sco-function-keys(on/off/toggle) This action sets, unsets or toggles the scoFunctionKeys resource. It is also invoked by the scoFunctionKeys entry in mainMenu.
set-scroll-on-key(on/off/toggle) This action sets, unsets or toggles the scrollKey resource.  It is also invoked from the scrollkey entry in vtMenu.
set-scroll-on-tty-output(on/off/toggle) This action sets, unsets or toggles the scrollTtyOutput resource. It is also invoked from the scrollttyoutput entry in vtMenu.
set-scrollbar(on/off/toggle) This action sets, unsets or toggles the scrollbar resource.  It is also invoked by the scrollbar entry in vtMenu.
set-select(on/off/toggle) This action sets, unsets or toggles the selectToClipboard resource.  It is also invoked by the selectToClipboard entry in vtMenu.
set-sixel-scrolling(on/off/toggle) This action toggles between inline (sixel scrolling) and absolute positioning.  It can also be controlled via DEC private mode 80 (DECSDM) or from the sixelScrolling entry in the btMenu.
set-sun-function-keys(on/off/toggle) This action sets, unsets or toggles the sunFunctionKeys resource. It is also invoked by the sunFunctionKeys entry in mainMenu.
set-sun-keyboard(on/off/toggle) This action sets, unsets or toggles the sunKeyboard resource.  It is also invoked by the sunKeyboard entry in mainMenu.
set-tek-text(large/2/3/small) This action sets the font used in the Tektronix window to the value of the selected resource according to the argument.  The argument can be either a keyword or single-letter alias, as shown in parentheses:
large (l) Use resource fontLarge, same as menu entry tektextlarge.
two (2) Use resource font2, same as menu entry tektext2.
three (3) Use resource font3, same as menu entry tektext3.
small (s) Use resource fontSmall, same as menu entry tektextsmall.
set-terminal-type(type) This action directs output to either the vt or tek windows, according to the type string.  It is also invoked by the tekmode entry in vtMenu and the vtmode entry in tekMenu.
set-titeInhibit(on/off/toggle) This action sets, unsets or toggles the titeInhibit resource, which controls switching between the alternate and current screens.
set-toolbar(on/off/toggle) This action sets, unsets or toggles the toolbar feature.  It is also invoked by the toolbar entry in mainMenu.
set-utf8-fonts(on/off/toggle) This action sets, unsets or toggles the utf8Fonts resource.  It is also invoked by the utf8-fonts entry in fontMenu.
set-utf8-mode(on/off/toggle) This action sets, unsets or toggles the utf8 resource.  It is also invoked by the utf8-mode entry in fontMenu.
set-utf8-title(on/off/toggle) This action sets, unsets or toggles the utf8Title resource.  It is also invoked by the utf8-title entry in fontMenu.
set-visibility(vt/tek,on/off/toggle) This action sets, unsets or toggles whether or not the vt or tek windows are visible.  It is also invoked from the tekshow and vthide entries in vtMenu and the vtshow and tekhide entries in tekMenu.
set-visual-bell(on/off/toggle) This action sets, unsets or toggles the visualBell resource.  It is also invoked by the visualbell entry in vtMenu.
set-vt-font(d/1/2/3/4/5/6/7/e/s [,normalfont [, boldfont]]) This action sets the font or fonts currently being used in the VTxxx window.  The first argument is a single character that specifies the font to be used:
d or D indicate the default font (the font initially used when xterm was started),
1 through 7 indicate the fonts specified by the font1 through font7 resources,
e or E indicate the normal and bold fonts that have been set through escape codes (or specified as the second and third action arguments, respectively), and
s or S indicate the font selection (as made by programs such as xfontsel(1)) indicated by the second action argument.
If xterm is configured to support wide characters, an additional two optional parameters are recognized for the e argument: wide font and wide bold font.
smaller-vt-font() Set the font to the next smaller one, based on the font dimensions.  See also set-vt-font().
soft-reset() This action resets the scrolling region.  It is also invoked from the softreset entry in vtMenu.  The effect is identical to a soft reset (DECSTR) control sequence.
spawn-new-terminal(params) Spawn a new xterm process.  This is available on systems which have a modern version of the process filesystem, e.g., “/proc”, which xterm can read.
Use the “cwd” process entry, e.g., /proc/12345/cwd to obtain the working directory of the process which is running in the current xterm.
On systems which have the “exe” process entry, e.g., /proc/12345/exe, use this to obtain the actual executable. Otherwise, use the $PATH variable to find xterm.
If parameters are given in the action, pass them to the new xterm process.
start-cursor-extend() This action is similar to select-extend except that the selection is extended to the current text cursor position.
start-extend() This action is similar to select-start except that the selection is extended to the current pointer location.
string(string) This action inserts the specified text string as if it had been typed.  Quotation is necessary if the string contains whitespace or non-alphanumeric characters.  If the string argument begins with the characters “0x”, it is interpreted as a hex character constant.
tek-copy() This action copies the escape codes used to generate the current window contents to a file in the current directory beginning with the name COPY.  It is also invoked from the tekcopy entry in tekMenu.
tek-page() This action clears the Tektronix window.  It is also invoked by the tekpage entry in tekMenu.
tek-reset() This action resets the Tektronix window.  It is also invoked by the tekreset entry in tekMenu.
vi-button() Handles a button event (other than press and release) by echoing a control sequence computed from the event's line number in the screen relative to the current line:
ESC ^P
ESC ^N
according to whether the event is before, or after the current line, respectively.  The ^N (or ^P) is repeated once for each line that the event differs from the current line.  The control sequence is omitted altogether if the button event is on the current line.
visual-bell() This action flashes the window quickly.
The Tektronix window also has the following action:
gin-press(l/L/m/M/r/R) This action sends the indicated graphics input code.
Default Key Bindings The default bindings in the VTxxx window use the SELECT token, which is set by the selectToClipboard resource.  These are for the vt100 widget:
Shift <KeyPress> Prior:scroll-back(1,halfpage) \n\ Shift <KeyPress> Next:scroll-forw(1,halfpage) \n\ Shift <KeyPress> Select:select-cursor-start() \ select-cursor-end(SELECT, CUT_BUFFER0) \n\ Shift <KeyPress> Insert:insert-selection(SELECT, CUT_BUFFER0) \n\ Alt <Key>Return:fullscreen() \n\ <KeyRelease> Scroll_Lock:scroll-lock() \n\ Shift~Ctrl <KeyPress> KP_Add:larger-vt-font() \n\ Shift Ctrl <KeyPress> KP_Add:smaller-vt-font() \n\ Shift <KeyPress> KP_Subtract:smaller-vt-font() \n\ ~Meta <KeyPress>:insert-seven-bit() \n\ Meta <KeyPress>:insert-eight-bit() \n\ !Ctrl <Btn1Down>:popup-menu(mainMenu) \n\ !Lock Ctrl <Btn1Down>:popup-menu(mainMenu) \n\ !Lock Ctrl @Num_Lock <Btn1Down>:popup-menu(mainMenu) \n\ ! @Num_Lock Ctrl <Btn1Down>:popup-menu(mainMenu) \n\ ~Meta <Btn1Down>:select-start() \n\ ~Meta <Btn1Motion>:select-extend() \n\ !Ctrl <Btn2Down>:popup-menu(vtMenu) \n\ !Lock Ctrl <Btn2Down>:popup-menu(vtMenu) \n\ !Lock Ctrl @Num_Lock <Btn2Down>:popup-menu(vtMenu) \n\ ! @Num_Lock Ctrl <Btn2Down>:popup-menu(vtMenu) \n\ ~Ctrl ~Meta <Btn2Down>:ignore() \n\ Meta <Btn2Down>:clear-saved-lines() \n\ ~Ctrl ~Meta <Btn2Up>:insert-selection(SELECT, CUT_BUFFER0) \n\ !Ctrl <Btn3Down>:popup-menu(fontMenu) \n\ !Lock Ctrl <Btn3Down>:popup-menu(fontMenu) \n\ !Lock Ctrl @Num_Lock <Btn3Down>:popup-menu(fontMenu) \n\ ! @Num_Lock Ctrl <Btn3Down>:popup-menu(fontMenu) \n\ ~Ctrl ~Meta <Btn3Down>:start-extend() \n\ ~Meta <Btn3Motion>:select-extend() \n\ Ctrl <Btn4Down>:scroll-back(1,halfpage,m) \n\ Lock Ctrl <Btn4Down>:scroll-back(1,halfpage,m) \n\ Lock @Num_Lock Ctrl <Btn4Down>:scroll-back(1,halfpage,m) \n\ @Num_Lock Ctrl <Btn4Down>:scroll-back(1,halfpage,m) \n\ <Btn4Down>:scroll-back(5,line,m)     \n\ Ctrl <Btn5Down>:scroll-forw(1,halfpage,m) \n\ Lock Ctrl <Btn5Down>:scroll-forw(1,halfpage,m) \n\ Lock @Num_Lock Ctrl <Btn5Down>:scroll-forw(1,halfpage,m) \n\ @Num_Lock Ctrl <Btn5Down>:scroll-forw(1,halfpage,m) \n\ <Btn5Down>:scroll-forw(5,line,m)     \n\ <BtnUp>:select-end(SELECT, CUT_BUFFER0) \n\ <BtnMotion>:pointer-motion() \n\ <BtnDown>:pointer-button() \n\ <BtnUp>:pointer-button() \n\ <BtnDown>:ignore()
The default bindings in the Tektronix window are analogous but less extensive.  These are for the tek4014 widget:
~Meta<KeyPress>: insert-seven-bit() \n\ Meta<KeyPress>: insert-eight-bit() \n\ !Ctrl <Btn1Down>: popup-menu(mainMenu) \n\ !Lock Ctrl <Btn1Down>: popup-menu(mainMenu) \n\ !Lock Ctrl @Num_Lock <Btn1Down>: popup-menu(mainMenu) \n\ !Ctrl @Num_Lock <Btn1Down>: popup-menu(mainMenu) \n\ !Ctrl <Btn2Down>: popup-menu(tekMenu) \n\ !Lock Ctrl <Btn2Down>: popup-menu(tekMenu) \n\ !Lock Ctrl @Num_Lock <Btn2Down>: popup-menu(tekMenu) \n\ !Ctrl @Num_Lock <Btn2Down>: popup-menu(tekMenu) \n\ Shift ~Meta<Btn1Down>: gin-press(L) \n\ ~Meta<Btn1Down>: gin-press(l) \n\ Shift ~Meta<Btn2Down>: gin-press(M) \n\ ~Meta<Btn2Down>: gin-press(m) \n\ Shift ~Meta<Btn3Down>: gin-press(R) \n\ ~Meta<Btn3Down>: gin-press(r)
Custom Key Bindings You can modify the translations resource by overriding parts of it, or merging your resources with it.
Here is an example which uses shifted select/paste to copy to the clipboard, and unshifted select/paste for the primary selection.  In each case, a (different) cut buffer is also a target or source of the select/paste operation.  It is important to remember however, that cut buffers store data in ISO-8859-1 encoding, while selections can store data in a variety of formats and encodings.  While xterm owns the selection, it highlights it.  When it loses the selection, it removes the corresponding highlight.  But you can still paste from the corresponding cut buffer.
*VT100*translations:    #override \n\ ~Shift~Ctrl<Btn2Up>: insert-selection(PRIMARY, CUT_BUFFER0) \n\ Shift~Ctrl<Btn2Up>: insert-selection(CLIPBOARD, CUT_BUFFER1) \n\ ~Shift     <BtnUp> : select-end(PRIMARY, CUT_BUFFER0) \n\ Shift     <BtnUp> : select-end(CLIPBOARD, CUT_BUFFER1)
In the example, the class name VT100 is used rather than the widget name. These are different; a class name could apply to more than one widget.  A leading “*” is used because the widget hierarchy above the vt100 widget depends on whether the toolbar support is compiled into xterm.
Most of the predefined translations are related to the mouse, with a few that use some of the special keys on the keyboard.  Applications use special keys (function-keys, cursor-keys, keypad-keys) with modifiers (shift, control, alt).  If xterm defines a translation for a given combination of special key and modifier, that makes it unavailable for use by applications within the terminal.  For instance, one might extend the use of Page Up and Page Down keys seen here:
Shift <KeyPress> Prior : scroll-back(1,halfpage) \n\ Shift <KeyPress> Next  : scroll-forw(1,halfpage) \n\
to the Home and End keys:
Shift <KeyPress> Home : scroll-to(begin) \n\ Shift <KeyPress> End  : scroll-to(end)
but then shift-Home and shift-End would then be unavailable to applications.
Not everyone finds the three-button mouse bindings easy to use.  In a wheel mouse, the middle button might be the wheel.  As an alternative, you could add a binding using shifted keys:
*VT100*translations:      #override \n\ Shift <Key>Home:    copy-selection(SELECT) \n\ Shift <Key>Insert:  copy-selection(SELECT) \n\ Ctrl Shift <Key>C:  copy-selection(SELECT) \n\ Ctrl Shift <Key>V:  insert-selection(SELECT)
You would still use the left- and right-mouse buttons (typically 1 and 3) for beginning and extending selections.
Besides mouse problems, there are also keyboards with inconvenient layouts.  Some lack a numeric keypad, making it hard to use the shifted keypad plus and minus bindings for switching between font sizes.  You can work around that by assigning the actions to more readily accessed keys:
*VT100*translations:      #override \n\ Ctrl <Key> +:       larger-vt-font() \n\ Ctrl <Key> -:       smaller-vt-font()
The keymap feature allows you to switch between sets of translations. The sample below shows how the keymap() action may be used to add special keys for entering commonly-typed words:
*VT100.Translations: #override <Key>F13: keymap(dbx) *VT100.dbxKeymap.translations: \ <Key>F14:       keymap(None) \n\ <Key>F17:       string("next") \n\ string(0x0d) \n\ <Key>F18:       string("step") \n\ string(0x0d) \n\ <Key>F19:       string("continue") \n\ string(0x0d) \n\ <Key>F20:       string("print ") \n\ insert-selection(PRIMARY, CUT_BUFFER0)
Default Scrollbar Bindings Key bindings are normally associated with the vt100 or tek4014 widgets which act as terminal emulators.  Xterm's scrollbar (and toolbar if it is configured) are separate widgets.  Because all of these use the X Toolkit, they have corresponding translations resources.  Those resources are distinct, and match different patterns, e.g., the differences in widget-name and number of levels of widgets which they may contain.
The scrollbar widget is a child of the vt100 widget.  It is positioned on top of the vt100 widget.  Toggling the scrollbar on and off causes the vt100 widget to resize.
The default bindings for the scrollbar widget use only mouse-button events:
<Btn5Down>: StartScroll(Forward) \n\ <Btn1Down>: StartScroll(Forward) \n\ <Btn2Down>: StartScroll(Continuous) MoveThumb() NotifyThumb() \n\ <Btn3Down>: StartScroll(Backward) \n\ <Btn4Down>: StartScroll(Backward) \n\ <Btn2Motion>: MoveThumb() NotifyThumb() \n\ <BtnUp>:    NotifyScroll(Proportional) EndScroll()
Events which the scrollbar widget does not recognize at all are lost.
However, at startup, xterm augments these translations with the default translations used for the vt100 widget, together with the resource “actions” which those translations use.  Because the scrollbar (or menubar) widgets do not recognize these actions (but because it has a corresponding translation), they are passed on to the vt100 widget.
This augmenting of the scrollbar's translations has a few limitations:
•   Xterm knows what the default translations are, but there is no suitable library interface for determining what customizations a user may have added to the vt100 widget.  All that xterm can do is augment the scrollbar widget to give it the same starting point for further customization by the user.
•   Events in the gap between the widgets may be lost.
•   Compose sequences begun in one widget cannot be completed in the other, because the input methods for each widget do not share context information.
Most customizations of the scrollbar translations do not concern key bindings.  Rather, users are generally more interested in changing the bindings of the mouse buttons.  For example, some people prefer using the left pointer button for dragging the scrollbar thumb.  That can be set up by altering the translations resource, e.g.,
*VT100.scrollbar.translations:  #override \n\ <Btn5Down>:     StartScroll(Forward) \n\ <Btn1Down>:     StartScroll(Continuous) MoveThumb() NotifyThumb() \n\ <Btn4Down>:     StartScroll(Backward) \n\ <Btn1Motion>:   MoveThumb() NotifyThumb() \n\ <BtnUp>:        NotifyScroll(Proportional) EndScroll()
Applications can send sequences of characters to the terminal to change its behavior.  Often they are referred to as “ANSI escape sequences” or just plain “escape sequences” but both terms are misleading:
•   ANSI x3.64 (obsolete) which was replaced by ISO 6429 (ECMA-48) gave rules for the format of these sequences of characters.
•   While the original VT100 was claimed to be ANSI-compatible (against x3.64), there is no freely available version of the ANSI standard to show where the VT100 differs.  Most of the documents which mention the ANSI standard have additions not found in the original (such as those based on ansi.sys).  So this discussion focuses on the ISO standards.
•   The standard describes only sequences sent from the host to the terminal.  There is no standard for sequences sent by special keys from the terminal to the host.  By convention (and referring to existing terminals), the format of those sequences usually conforms to the host-to-terminal standard.
•   Some of xterm's sequences do not fit into the standard scheme. Technically those are “unspecified”.  As an example, DEC Screen Alignment Test (DECALN) is this three-character sequence:
ESC # 8
•   Some sequences fit into the standard format, but are not listed in the standard.  These include the sequences used for setting up scrolling margins and doing forward/reverse scrolling.
•   Some of the sequences (in particular, the single-character functions such as tab and backspace) do not include the escape character.
With all of that in mind, the standard refers to these sequences of characters as “control sequences”.
Xterm Control Sequences lists the control sequences which an application can send xterm to make it perform various operations.  Most of these operations are standardized, from either the DEC or Tektronix terminals, or from more widely used standards such as ISO-6429.
A few examples of usage are given in this section.
Window and Icon Titles Some scripts use echo with options -e and -n to tell the shell to interpret the string “\e” as the escape character and to suppress a trailing newline on output.  Those are not portable, nor recommended. Instead, use printf (POSIX).
For example, to set the window title to “Hello world!”, you could use one of these commands in a script:
printf '\033]2;Hello world!\033\' printf '\033]2;Hello world!\007' printf '\033]2;%s\033\' "Hello world!" printf '\033]2;%s\007' "Hello world!"
The printf command interprets the octal value “\033” for escape, and (since it was not given in the format) omits a trailing newline from the output.
Some programs (such as screen(1)) set both window- and icon-titles at the same time, using a slightly different control sequence:
printf '\033]0;Hello world!\033\' printf '\033]0;Hello world!\007' printf '\033]0;%s\033\' "Hello world!" printf '\033]0;%s\007' "Hello world!"
The difference is the parameter “0” in each command.  Most window managers will honor either window title or icon title.  Some will make a distinction and allow you to set just the icon title.  You can tell xterm to ask for this with a different parameter in the control sequence:
printf '\033]1;Hello world!\033\' printf '\033]1;Hello world!\007' printf '\033]1;%s\033\' "Hello world!" printf '\033]1;%s\007' "Hello world!"
Special Keys Xterm, like any VT100-compatible terminal emulator, has two modes for the special keys (cursor-keys, numeric keypad, and certain function-keys):
•   normal mode, which makes the special keys transmit “useful” sequences such as the control sequence for cursor-up when pressing the up- arrow, and
•   application mode, which uses a different control sequence that cannot be mistaken for the “useful” sequences.
The main difference between the two modes is that normal mode sequences start with CSI (escape [) and application mode sequences start with SS3 (escape O).
The terminal is initialized into one of these two modes (usually the normal mode), based on the terminal description (termcap or terminfo). The terminal description also has capabilities (strings) defined for the keypad mode used in curses applications.
There is a problem in using the terminal description for applications that are not intended to be full-screen curses applications: the definitions of special keys are only correct for this keypad mode.  For example, some shells (unlike ksh(1), which appears to be hard-coded, not even using termcap) allow their users to customize key-bindings, assigning shell actions to special keys.
•   bash(1) allows constant strings to be assigned to functions.  This is only successful if the terminal is initialized to application mode by default, because bash lacks flexibility in this area.  It uses a (less expressive than bash's) readline scripting language for setting up key bindings, which relies upon the user to statically enumerate the possible bindings for given values of $TERM.
•   zsh(1) provides an analogous feature, but it accepts runtime expressions, as well as providing a $terminfo array for scripts.  In particular, one can use the terminal database, transforming when defining a key-binding.  By transforming the output so that CSI and SS3 are equated, zsh can use the terminal database to obtain useful definitions for its command-line use regardless of whether the terminal uses normal or application mode initially.  Here is an example:
[[ "$terminfo[kcuu1]" == "^[O"* ]] && \ bindkey -M viins "${terminfo[kcuu1]/O/[}" \ vi-up-line-or-history
Changing Colors A few shell programs provide the ability for users to add color and other video attributes to the shell prompt strings.  Users can do this by setting $PS1 (the primary prompt string).  Again, bash and zsh have provided features not found in ksh.  There is a problem, however: the prompt's width on the screen will not necessarily be the same as the number of characters.  Because there is no guidance in the POSIX standard, each shell addresses the problem in a different way:
•   bash treats characters within “\[” and “\]” as nonprinting (using no width on the screen).
•   zsh treats characters within “%{” and “%}” as nonprinting.
In addition to the difference in syntax, the shells provide different methods for obtaining useful escape sequences:
•   As noted in Special Keys, zsh initializes the $terminfo array with the terminal capabilities.
It also provides a function echoti which works like tput(1) to convert a terminal capability with its parameters into a string that can be written to the terminal.
•   Shells lacking a comparable feature (such as bash) can always use the program tput to do this transformation.
Hard-coded escape sequences are supported by each shell, but are not recommended because those rely upon particular configurations and cannot be easily moved between different user environments.
Xterm sets several environment variables.
System Independent Some variables are used on every system:
DISPLAY is the display name, pointing to the X server (see DISPLAY NAMES in X(1)).
TERM is set according to the terminfo (or termcap) entry which it is using as a reference.
On some systems, you may encounter situations where the shell which you use and xterm are built using libraries with different terminal databases.  In that situation, xterm may choose a terminal description not known to the shell.
WINDOWID is set to the X window id number of the xterm window.
XTERM_FILTER is set if a locale-filter is used.  The value is the pathname of the filter.
XTERM_LOCALE shows the locale which was used by xterm on startup.  Some shell initialization scripts may set a different locale.
XTERM_SHELL is set to the pathname of the program which is invoked.  Usually that is a shell program, e.g., /bin/sh.  Since it is not necessarily a shell program however, it is distinct from “SHELL”.
XTERM_VERSION is set to the string displayed by the -version option.  That is normally an identifier for the X Window libraries used to build xterm, followed by xterm's patch number in parenthesis.  The patch number is also part of the response to a Secondary Device Attributes (DA) control sequence (see Xterm Control Sequences).
System Dependent Depending on your system configuration, xterm may also set the following:
COLUMNS the width of the xterm in characters (cf: “stty columns”).
When this variable is set, curses applications (and most terminal programs) will assume that the terminal has this many columns.
Xterm would do this for systems which have no ability to tell the size of the terminal.  Those are very rare, none newer than the mid 1990s when SVR4 became prevalent.
HOME when xterm is configured (at build-time) to update utmp.
LINES the height of the xterm in characters (cf: “stty rows”).
When this variable is set, curses applications (and most terminal programs) will assume that the terminal has this many lines (rows).
LOGNAME when xterm is configured (at build-time) to update utmp.
Your configuration may have set LOGNAME; xterm does not modify that. If it is unset, xterm will use USER if it is set.  Finally, if neither is set, xterm will use the getlogin(3) function.
SHELL when xterm is configured (at build-time) to update utmp.  It is also set if you provide a valid shell name as the optional parameter.
Xterm sets this to an absolute pathname.  If you have set the variable to a relative pathname, xterm may set it to a different shell pathname.
If you have set this to an pathname which does not correspond to a valid shell, xterm may unset it, to avoid confusion.
TERMCAP the contents of the termcap entry corresponding to $TERM, with lines and columns values substituted for the actual size window you have created.
This feature is, like LINES and COLUMNS, used rarely.  It addresses the same limitation of a few older systems by providing a way for termcap-based applications to get the initial screen size.
TERMINFO may be defined to a nonstandard location using the configure script.
In the output from xprop(1), there are several properties.
Properties set by X Toolkit WM_CLASS This shows the instance name and the X resource class, passed to X Toolkit during initialization of xterm, e.g.,
WM_CLASS(STRING) = "xterm", "UXTerm"
WM_CLIENT_LEADER This shows the window-id which xterm provides with an environment variable (WINDOWID), e.g.,
WM_CLIENT_LEADER(WINDOW): window id # 0x800023
WM_COMMAND This shows the command-line arguments for xterm which are passed to X Toolkit during initialization, e.g.,
WM_COMMAND(STRING) = { "xterm", "-class", "UXTerm", "-title", "uxterm", "-u8" }
WM_ICON_NAME This holds the icon title, which different window managers handle in various ways.  It is set via the iconName resource.  Applications can change this using control sequences.
WM_LOCALE_NAME This shows the result from the setlocale(3) function for the LC_CTYPE category, e.g.,
WM_LOCALE_NAME(STRING) = "en_US.UTF-8"
WM_NAME This holds the window title, normally at the top of xterm's window. It is set via the title resource.  Applications can change this using control sequences.
Properties set by Xterm X Toolkit does not manage EWMH properties.  Xterm does this directly.
_NET_WM_ICON_NAME stores the icon name.
_NET_WM_NAME stores the title string.
_NET_WM_PID stores the process identifier for xterm's display.
Properties used by Xterm _NET_SUPPORTED Xterm checks this property on the supporting window to decide if the window manager supports specific maximizing styles.  That may include other window manager hints; xterm uses the X library calls to manage those.
_NET_SUPPORTING_WM_CHECK Xterm checks this to ensure that it will only update the EWMH properties for a window manager which claims EWMH compliance.
_NET_WM_STATE This tells xterm whether its window has been maximized by the window manager, and if so, what type of maximizing:
_NET_WM_STATE_FULLSCREEN
_NET_WM_STATE_MAXIMIZED_HORZ
_NET_WM_STATE_MAXIMIZED_VERT
The actual pathnames given may differ on your system.
/etc/shells contains a list of valid shell programs, used by xterm to decide if the “SHELL” environment variable should be set for the process started by xterm.
On systems which have the getusershell function, xterm will use that function rather than directly reading the file, since the file may not be present if the system uses default settings.
/etc/utmp the system log file, which records user logins.
/etc/wtmp the system log file, which records user logins and logouts.
/usr/share/X11/app-defaults//XTerm the xterm default application resources.
/usr/share/X11/app-defaults//XTerm-color the xterm color application resources.  If your display supports color, use this
*customization: -color
in your .Xdefaults file to automatically use this resource file rather than /usr/share/X11/app-defaults//XTerm.  If you do not do this, xterm uses its compiled-in default resource settings for colors.
/usr/share/pixmaps the directory in which xterm's pixmap icon files are installed.
Most of the fatal error messages from xterm use the following format:
xterm: Error XXX, errno YYY: ZZZ
The XXX codes (which are used by xterm as its exit-code) are listed below, with a brief explanation.
1    is used for miscellaneous errors, usually accompanied by a specific message,
11   ERROR_FIONBIO main: ioctl() failed on FIONBIO
12   ERROR_F_GETFL main: ioctl() failed on F_GETFL
13   ERROR_F_SETFL main: ioctl() failed on F_SETFL
14   ERROR_OPDEVTTY spawn: open() failed on /dev/tty
15   ERROR_TIOCGETP spawn: ioctl() failed on TIOCGETP
17   ERROR_PTSNAME spawn: ptsname() failed
18   ERROR_OPPTSNAME spawn: open() failed on ptsname
19   ERROR_PTEM spawn: ioctl() failed on I_PUSH/"ptem"
20   ERROR_CONSEM spawn: ioctl() failed on I_PUSH/"consem"
21   ERROR_LDTERM spawn: ioctl() failed on I_PUSH/"ldterm"
22   ERROR_TTCOMPAT spawn: ioctl() failed on I_PUSH/"ttcompat"
23   ERROR_TIOCSETP spawn: ioctl() failed on TIOCSETP
24   ERROR_TIOCSETC spawn: ioctl() failed on TIOCSETC
25   ERROR_TIOCSETD spawn: ioctl() failed on TIOCSETD
26   ERROR_TIOCSLTC spawn: ioctl() failed on TIOCSLTC
27   ERROR_TIOCLSET spawn: ioctl() failed on TIOCLSET
28   ERROR_INIGROUPS spawn: initgroups() failed
29   ERROR_FORK spawn: fork() failed
30   ERROR_EXEC spawn: exec() failed
32   ERROR_PTYS get_pty: not enough ptys
34   ERROR_PTY_EXEC waiting for initial map
35   ERROR_SETUID spawn: setuid() failed
36   ERROR_INIT spawn: can't initialize window
46   ERROR_TIOCKSET spawn: ioctl() failed on TIOCKSET
47   ERROR_TIOCKSETC spawn: ioctl() failed on TIOCKSETC
49   ERROR_LUMALLOC luit: command-line malloc failed
50   ERROR_SELECT in_put: select() failed
54   ERROR_VINIT VTInit: can't initialize window
57   ERROR_KMMALLOC1 HandleKeymapChange: malloc failed
60   ERROR_TSELECT Tinput: select() failed
64   ERROR_TINIT TekInit: can't initialize window
71   ERROR_BMALLOC2 SaltTextAway: malloc() failed
80   ERROR_LOGEXEC StartLog: exec() failed
83   ERROR_XERROR xerror: XError event
84   ERROR_XIOERROR xioerror: X I/O error
85   ERROR_ICEERROR ICE I/O error
90   ERROR_SCALLOC Alloc: calloc() failed on base
91   ERROR_SCALLOC2 Alloc: calloc() failed on rows
102  ERROR_SAVE_PTR ScrnPointers: malloc/realloc() failed
Large pastes do not work on some systems.  This is not a bug in xterm; it is a bug in the pseudo terminal driver of those systems.  Xterm feeds large pastes to the pty only as fast as the pty will accept data, but some pty drivers do not return enough information to know if the write has succeeded.
When connected to an input method, it is possible for xterm to hang if the XIM server is suspended or killed.
Many of the options are not resettable after xterm starts.
This program still needs to be rewritten.  It should be split into very modular sections, with the various emulators being completely separate widgets that do not know about each other.  Ideally, you'd like to be able to pick and choose emulator widgets and stick them into a single control widget.
There needs to be a dialog box to allow entry of the Tek COPY file name.
resize(1), luit(1), uxterm(1), X(1), Xcursor(1), pty(4), tty(4)
Xterm Control Sequences (this is the file ctlseqs.ms).
https://invisible-island.net/xterm/xterm.html https://invisible-island.net/xterm/manpage/xterm.html https://invisible-island.net/xterm/ctlseqs/ctlseqs.html https://invisible-island.net/xterm/xterm.faq.html https://invisible-island.net/xterm/xterm.log.html
X Toolkit Intrinsics – C Language Interface (Xt), Joel McCormack, Paul Asente, Ralph R. Swick (1994), Thomas E. Dickey (2019).
Inter-Client Communication Conventions Manual (ICCCM), David Rosenthal and Stuart W. Marks (version 2.0, 1994).
Extended Window Manager Hints (EWMH), X Desktop Group (version 1.3, 2005).
EWMH uses UTF8_STRING pervasively without defining it, but does mention the ICCCM.  Version 2.0 of the ICCCM does not address UTF-8.  That is an extension added in XFree86.
•   Markus Kuhn summarized this in UTF-8 and Unicode FAQ for Unix/Linux (2001), in the section “Is X11 ready for Unicode?”
https://www.cl.cam.ac.uk/~mgk25/unicode.html
•   Juliusz Chroboczek proposed the UTF8_STRING selection atom in 1999/2000, which became part of the ICCCM in XFree86.
https://www.irif.fr/~jch/software/UTF8_STRING/
An Xorg developer removed that part of the documentation in 2004 when incorporating other work from XFree86 into Xorg.  The feature is still supported in Xorg, though undocumented as of 2019.
Far too many people.
These contributed to the X Consortium: Loretta Guarino Reid (DEC-UEG- WSL), Joel McCormack (DEC-UEG-WSL), Terry Weissman (DEC-UEG-WSL), Edward Moy (Berkeley), Ralph R. Swick (MIT-Athena), Mark Vandevoorde (MIT- Athena), Bob McNamara (DEC-MAD), Jim Gettys (MIT-Athena), Bob Scheifler (MIT X Consortium), Doug Mink (SAO), Steve Pitschke (Stellar), Ron Newman (MIT-Athena), Jim Fulton (MIT X Consortium), Dave Serisky (HP), Jonathan Kamens (MIT-Athena).
Beginning with XFree86, there were far more identifiable contributors. The THANKS file in xterm's source lists 234 in August 2021.  Keep in mind these: Jason Bacon, Jens Schweikhardt, Ross Combs, Stephen P. Wall, David Wexelblat, and Thomas Dickey (invisible-island.net).
TRANS(1)                                                                TRANS(1)
trans - Command-line translator using Google Translate, Bing Translator, Yandex.Translate, etc.
trans [OPTIONS] [SOURCE]:[TARGETS] [TEXT]...
This tool translates text into any language from the command-line, using a translation engine such as Google Translate, Bing Translator and Yandex.Translate.
Each argument which is not a valid option is treated as TEXT to be translated.
If neither TEXT nor the input file is specified by command-line arguments, the program will read and translate from standard input.
Information options -V, -version Print version and exit.
-H, -help Print help message and exit.  -M, -man Show man page and exit.
-T, -reference Print reference table of all supported languages and codes, and exit.  Names of languages are displayed in their endonyms (language name in the language itself).
-R, -reference-english Print reference table of all supported languages and codes, and exit.  Names of languages are displayed in English.
-L CODES, -list CODES Print details of languages and exit.  When specifying two or more language codes, concatenate them by plus sign "+".
-S, -list-engines List available translation engines and exit.
-U, -upgrade Check for upgrade of this program.
Translator options -e ENGINE, -engine ENGINE Specify the translation engine to use.  (default: google)
Display options -verbose Verbose mode.
Show the original text and its most relevant translation, then its phonetic notation (if any), then its alternative translations (if any) or its definition in the dictionary (if it is a word).
This option is unnecessary in most cases since verbose mode is enabled by default.
-b, -brief Brief mode.
Show the most relevant translation or its phonetic notation only.
-d, -dictionary Dictionary mode.
Show the definition of the original word in the dictionary.
-identify Language identification.
Show the identified language of the original text.
-show-original Y/n Show original text or not.  (default: yes)
-show-original-phonetics Y/n Show phonetic notation of original text or not.  (default: yes)
-show-translation Y/n Show translation or not.  (default: yes)
-show-translation-phonetics Y/n Show phonetic notation of translation or not.  (default: yes)
-show-prompt-message Y/n Show prompt message or not.  (default: yes)
-show-languages Y/n Show source and target languages or not.  (default: yes)
-show-original-dictionary y/N Show dictionary entry of original text or not.  (default: no)
This option is enabled in dictionary mode.
-show-dictionary Y/n Show dictionary entry of translation or not.  (default: yes)
-show-alternatives Y/n Show alternative translations or not.  (default: yes)
-w NUM, -width NUM Specify the screen width for padding.
This option overrides the setting of environment variable $COLUMNS.
-indent NUM Specify the size of indent (number of spaces).  (default: 4)
-theme FILENAME Specify the theme to use.  (default: default)
-no-theme Do not use any other theme than default.
-no-ansi Do not use ANSI escape codes.
-no-autocorrect Do not autocorrect.  (if defaulted by the translation engine)
-no-bidi Do not convert bidirectional texts.
-bidi  Always convert bidirectional texts.
-no-warn Do not write warning messages to stderr.
-dump  Print raw API response instead.
Audio options -p, -play Listen to the translation.
You must have at least one of the supported audio players (mplayer, mpv or mpg123) installed to stream from Google Text-to-Speech engine.  Otherwise, a local speech synthesizer may be used instead (say on macOS, espeak on Linux or other platforms).
-speak Listen to the original text.
-n VOICE, -narrator VOICE Specify the narrator, and listen to the translation.
Common values for this option are male and female.
-player PROGRAM Specify the audio player to use, and listen to the translation.
Option -play will try to use mplayer, mpv or mpg123 by default, since these players are known to work for streaming URLs.  Not all command-line audio players can work this way.  Use this option only when you have your own preference.
This option overrides the setting of environment variable $PLAYER.
-no-play Do not listen to the translation.
-no-translate Do not translate anything when using -speak.
-download-audio Download the audio to the current directory.
-download-audio-as FILENAME Download the audio to the specified file.
Terminal paging and browsing options -v, -view View the translation in a terminal pager (less, more or most).
-pager PROGRAM Specify the terminal pager to use, and view the translation.
This option overrides the setting of environment variable $PAGER.
-no-view, -no-pager Do not view the translation in a terminal pager.
-browser PROGRAM Specify the web browser to use.
This option overrides the setting of environment variable $BROWSER.
-no-browser Do not open the web browser.
Networking options -x HOST:PORT, -proxy HOST:PORT Use HTTP proxy on given port.
This option overrides the setting of environment variables $HTTP_PROXY and $http_proxy.
-u STRING, -user-agent STRING Specify the User-Agent to identify as.
This option overrides the setting of environment variables $USER_AGENT.
-4, -ipv4, -inet4-only Connect only to IPv4 addresses.
-6, -ipv6, -inet6-only Connect only to IPv6 addresses.
Interactive shell options -I, -interactive, -shell Start an interactive shell, invoking rlwrap whenever possible (unless -no-rlwrap is specified).
-E, -emacs Start the GNU Emacs front-end for an interactive shell.
This option does not need to, and cannot be used along with -I or -no-rlwrap.
-no-rlwrap Do not invoke rlwrap when starting an interactive shell.
This option is useful when your terminal type is not supported by rlwrap (e.g.  emacs).
I/O options -i FILENAME, -input FILENAME Specify the input file.
Source text to be translated will be read from the input file, instead of standard input.
-o FILENAME, -output FILENAME Specify the output file.
Translations will be written to the output file, instead of standard output.
Language preference options -l CODE, -hl CODE, -lang CODE Specify your home language (the language you would like to see for displaying prompt messages in the translation).