Fact-checked by Grok 2 weeks ago

xterm

xterm is a terminal emulator for the X Window System, designed to provide emulation of DEC VT102/VT220 (VTxxx) and Tektronix 4014 compatible terminals, enabling users to run command-line applications in a graphical windowed environment on Unix-like operating systems. Originally developed in 1984 by Mark Vandevoorde as a standalone terminal emulator for the DEC VS100 system during his co-op at Digital Equipment Corporation, xterm predates the X Window System itself and was subsequently retargeted to X by Jim Gettys, with significant contributions from developers like Bob McNamara for the ANSI parser and Doug Mink for Tektronix support. It became the standard terminal emulator bundled with X11 releases starting from the mid-1980s, supporting features such as remote display via the X protocol and compatibility with later VT series enhancements like VT320, VT420, and VT520 control sequences, within the broader capabilities of the X Window System that allow multiple windows per process. Over its evolution, xterm has incorporated ANSI color support, background color erase, ISO/ANSI colors, text rendering, 256-color terminals, and Powerline glyphs, making it highly configurable through resources like X resources files and adaptable for modern workflows while remaining lightweight and portable across and Unix systems. As an open-source program, it has been actively maintained by E. Dickey since 1995, with ongoing updates addressing stability, feature enhancements, and compatibility, as documented in its change log; as of September 2025 (patch #402), it continues to serve as a foundational tool in X.org and other distributions despite the rise of alternative emulators.

History and Development

Origins

xterm was developed in the summer of 1984 by Mark Vandevoorde, a co-op student at (DEC), as a stand-alone for the 100 (VS100). The VS100, introduced by (DEC) in 1984, was a programmable graphics terminal designed to connect to VAX minicomputers running the VAX/VMS operating system, featuring a display but lacking a . Vandevoorde's implementation emulated hardware terminals to bridge this gap, allowing users to interact with VAX/VMS applications in a graphical precursor environment. The primary purpose of this early xterm was to provide compatibility with DEC VT102 terminals for text-based interactions and Tektronix 4014 terminals for graphics, enabling programs on that could not directly utilize graphical displays to function effectively. This emulation addressed the limitations of the VS100's standalone nature, where multiple such devices might connect to a single VAX host, simulating dedicated terminals for each user without requiring native window system support. As the began evolving in 1984, xterm was ported to it around 1985-1986, marking its first integration into the nascent X10 protocol during the early development phase at MIT's . This adaptation transformed the standalone emulator into a foundational component of the emerging X ecosystem, aligning its capabilities with the distributed windowing architecture.

Maintenance and Versions

Following its initial adaptation for the in the mid-1980s, xterm was integrated into the official X11 distribution by the X Consortium, becoming a standard component of releases such as X11R4 in 1989. Maintenance of xterm shifted to the project around , coinciding with the forking of X11R6.3 development, as the X Consortium's reference implementation saw reduced updates. In this period, Thomas E. Dickey emerged as the primary developer, taking over active stewardship and contributing the majority of enhancements through a collaborative model initially hosted in XFree86's CVS repository. From 1996 onward, xterm adopted a patch-based release model, where incremental updates were numbered sequentially and applied to the base codebase, allowing for targeted feature additions and bug fixes without full rebuilds. This approach, formalized under , enabled rapid iteration; for instance, patch #39 in May 1997 introduced support for 16-color extensions beyond the standard 8-color palette. Key milestones in this evolution include the adoption of VT420 as the default emulation level in patch #280 (June 2012), which enhanced support for advanced DEC terminal features like dynamic margins and improved character handling. Truecolor (24-bit RGB) support arrived in patch #314 (December 2014), enabling direct rendering of millions of colors via escape sequences like OSC 4, a significant upgrade for graphical applications in terminals. As of October 2025, the latest release is xterm-403 (October 19, 2025), which incorporates bug fixes for rendering edge cases and minor enhancements to X11 protocol interactions, such as improved handling of indirect color requests. xterm remains distributed as part of the releases and is included by default in the package repositories of most operating systems, including distributions like and .

Core Functionality

Terminal Emulation

xterm primarily emulates the DEC VT102 terminal as its baseline, incorporating extensions from VT220, VT320, VT420, and partial support for VT520 features such as advanced character sets. Since patch 280 in June 2012, xterm has defaulted to VT420-level emulation to better align with modern terminal expectations, while still providing backward compatibility with earlier VT standards through configurable options like the -ti parameter for specifying terminal IDs such as vt100 or vt220. The emulator handles key behaviors through standard escape sequences defined in these VT protocols, including cursor movement (e.g., sequences for up, down, left, right), screen clearing operations (e.g., DECSTR for soft reset and full screen erase), and DEC private modes such as DECSC (save cursor) and DECRC (restore cursor) for position preservation during operations like scrolling or redrawing. Other notable private modes include DECAWM for automatic margin wrapping (enabled by default) and DECCOLM for toggling between 80- and 132-column widths, ensuring precise control over the display layout in command-line applications. For international character sets, xterm supports ISO 2022 protocols for switching between national replacement character sets (NRCS) and designated graphic sets, such as ISO Latin-1 as the default for DEC supplemental graphics. Additionally, it provides encoding compatibility via the -u8 option or the utf8 resource, allowing seamless rendering of text in locales that require it, with adjustments for CJK character widths configurable through the -cjk_width option. Unlike hardware terminals, xterm performs software-based rendering on a default 24-row by 80-column grid using fixed-pitch fonts, which can be resized dynamically via window management while maintaining integrity. It includes a configurable , defaulting to 1024 lines stored off-screen via the saveLines , enabling users to review previous output without losing terminal state. xterm also implements compatibility modes through its own extensions to these standards, such as custom escape sequences for window title updates (e.g., OSC 0 for icon name and title), which are widely recognized by modern shells like and zsh to enhance feedback without breaking core VT compliance.

Graphics Emulation

xterm provides emulation for the 4014, a legacy terminal introduced in 1974, enabling support for plotting and line-drawing applications through monochrome . This emulation allows xterm to interpret and render commands originally designed for the 4014's direct-view display, which featured a 1024x1024 for vector-based output. The feature was initially developed in 1985 by Doug Mink at the to support scientific software, such as that used in the Spacelab 2 mission, and later enhanced by maintainer E. Dickey in the 1990s. Activation of mode occurs via the command-line option -tk or by setting the X resource tekStartup to true, which starts xterm directly in emulation; alternatively, it can be toggled during using escape sequences like ? 38 h (DECSET mode 38) or through the menu accessed by pressing Control and the second . Once enabled, the emulation overlays a separate or within the xterm , switching from the primary VT102 via sequences such as GS (Ctrl-]) for graph mode, RS (Ctrl-^) for incremental plot mode, or (Ctrl-) for point plot mode. This setup historically facilitated with Unix-based scientific and tools on systems like PDP-11, where terminals were common for (CAD) and data visualization in the 1980s and 1990s. Key features include support for vector drawing commands, such as absolute plotting (\033[Px;Pyf) and relative plotting (\033[Px;Pyg), which render lines using XDrawLine primitives from the X Window System. Various line styles are emulated, including solid, dotted, dot-dashed, short-dashed, and long-dashed vectors, with options for normal, defocused, or write-through Z-axis modes via escape sequences like ESC ` for solid normal lines or ESC p for write-through solid. Text rendering in the graphics plane is also supported through alpha mode (US, Ctrl-_), allowing basic character sets selected with sequences such as ESC 8 or ESC 9, enabling annotations on plots. These capabilities made xterm suitable for legacy applications requiring graphical output without native X11 support. Despite its utility, the emulation has notable limitations: it supports only monochrome vectors without capabilities, lacks color rendering, and does not incorporate modern . The geometry is fixed at runtime, defaulting to a maximum of 1000x1000 pixels controlled by the maxGraphicSize , and requires compile-time enabling of support. Additionally, advanced 4014 features like doublesize characters or soft characters are not implemented, and switching between and VT modes uses a shared , potentially limiting seamless integration in contemporary workflows.

Configuration

Command-Line Options

xterm is invoked from the command line using the syntax xterm [options] [-e program [arguments...]], where options customize the terminal's appearance, behavior, and initial program execution, and the -e option specifies an embedded command to run instead of the default shell (which must be the last argument). The program accepts standard X Toolkit Intrinsics options alongside xterm-specific flags, allowing one-time overrides of default behaviors at launch. Key options for window geometry and appearance include -geometry, which sets the preferred size and position in the format widthxheight+x+y (e.g., 80x24+100+100 for an 80-column by 24-row window positioned 100 pixels from the top-left); -title, which specifies the window title string (e.g., MyTerm); -sl, which configures the scrollback buffer size in lines (default: 1024, e.g., -sl 1000); -fg and -bg, which set the foreground and background colors respectively (defaults: XtDefaultForeground and XtDefaultBackground, e.g., -fg blue -bg white); -fn, which selects the normal text font (default: fixed, e.g., -fn "DejaVu Sans Mono-12"); and +tb, which disables the display. For session management, -ls enables a login shell by prepending a hyphen to the shell's argv[0] (default: false, e.g., xterm -ls); and -hold prevents the window from closing after the shell or program terminates. Debugging and options encompass -rv, which reverses foreground and background colors for high-contrast displays; and -audit, which activates logging for events (related to the -l logging option). These command-line options provide runtime flexibility, distinct from persistent configurations set via X resources. The following table summarizes selected key options:
OptionDescriptionExample
-geometrySets window size and positionxterm -geometry 80x24+100+100
-titleSets window titlexterm -title "My Terminal"
-slSets scrollback linesxterm -sl 2000
-fg / -bgSets foreground / background colorxterm -fg [black](/page/Black) -bg white
-lsEnables login shellxterm -ls
-holdHolds window after program exitxterm -hold
-auditEnables audit loggingxterm -audit
-rvReverses video (colors)xterm -rv
-fnSets fontxterm -fn fixed
+tbDisables toolbarxterm +tb
-eExecutes specified programxterm -e vim

X Resources

xterm employs the X Toolkit Intrinsics resource database for persistent customization of its appearance and behavior, allowing users to define settings that persist across sessions without relying on command-line options. Resources are stored in a hierarchical structure, with the top-level class typically denoted as XTerm, followed by widget-specific components such as the vt100 widget for terminal emulation. The resource hierarchy draws from system-wide app-defaults files, such as /etc/X11/app-defaults/XTerm, which provide baseline configurations, and user-specific files like ~/.Xresources for overrides. For instance, enabling a can be set with XTerm*scrollBar: true in the user's ~/.Xresources file. Categories of resources include those for the widget, such as XTerm*vt100.geometry: 80x24 to specify window dimensions, and menu-related resources, like XTerm*vtMenu.menubar: off to disable the menu bar. Resources are loaded into the database using the xrdb command, typically via xrdb -merge ~/.Xresources before starting xterm, ensuring settings apply at startup. Dynamic reloading is possible through the reinitResources action, which can be invoked via the main menu or control sequences to update the resource database without restarting the application. Advanced customization leverages class resources for theming, where capitalized names like XTerm*color0: #000000 define specific colors, such as black for the background. The faceName resource supports scalable fonts, specified as patterns like XTerm*faceName: xft:DejaVu [Sans](/page/Sans) Mono to select FreeType-rendered fonts for improved rendering. In terms of precedence, command-line options take priority over resource settings, which in turn override the defaults from app-defaults files, allowing flexible layering of configurations from specific invocations to global themes.

Display and Rendering

Font Handling

xterm provides robust support for font selection and rendering to ensure clear text display in its emulation environment. Traditionally, it relies on legacy PCF (Portable Compiled Format) fonts, which are fixed-width and specified via the -fn command-line option or the XTerm*font X resource. Common examples include the built-in "fixed" font or "6x10", offering reliable but pixelated rendering suitable for early displays. These fonts form the default fallback mechanism, ensuring compatibility with older systems where scalable fonts are unavailable. In 2000, xterm introduced support for modern Xft (X FreeType) and fonts, enabling anti-aliased, scalable text rendering through the faceName resource, such as xft:Monospace. This enhancement, integrated via early patches to align with developments, leverages the Xft library and for superior glyph quality and size flexibility, contrasting the rigid pixel sizes of fonts. If no suitable normal and bold fonts match the faceName specification, xterm reverts to alternatives specified in related resources like font. Key features include dedicated resources for font variants and dynamic switching. Bold and double-sized text can be handled via boldFont for legacy modes or faceNameDoublesize for , while italic rendering is supported indirectly through typefaces when available. Users can switch fonts at using the Font menu, accessed by holding Ctrl and right-clicking, which offers options like "Tiny" to "Enormous" sizes (corresponding to font1 through font7 resources) and toggles for "TrueType Fonts". This menu facilitates quick adjustments without restarting the terminal. Despite these capabilities, xterm enforces a monospace requirement for all fonts to preserve character alignment within its fixed-width grid, prohibiting variable-width fonts that could disrupt terminal layouts. Additionally, bold modes may fall back to overstriking if separate bold fonts are unavailable or mismatched in dimensions. Font rendering in contemporary xterm versions occurs server-side, utilizing the XRender extension for enhanced and smoother edges on scalable fonts, improving readability on high-resolution displays. The renderFont resource controls initial use of rendering (set to true, false, or default), with further tweaks like scaleHeight allowing line-height adjustments between 0.9 and 1.5 for .

Color Support

xterm provides robust color support, beginning with the standard 16-color ANSI palette and extending to advanced modes for richer visual rendering in terminal applications. This capability was introduced in patch #39 on May 24, 1997, enabling the use of ISO 6429 sequences to select from 8 colors plus 8 bright variants for foreground and background. For example, the sequence CSI 31m sets the foreground to red, while CSI 41m sets the background to red, allowing applications to display colored text without relying on output. Extended color modes build on this foundation, with 256-color support added in patch #111 on July 10, 1999, and 88-color support in patch #115 on September 18, 1999. The 256-color mode combines the 16 ANSI colors with a 6x6x6 RGB (indices 16-231) and a 24-step ramp (indices 232-255), accessed via sequences like CSI 38;5;196m for a bright red foreground. Similarly, the 88-color mode uses a subset palette with CSI 38;5;n m where n ranges from 0 to 87. These modes are detected by applications through the $TERM=xterm-256color or $TERM=xterm-88color, ensuring compatibility with tools expecting enhanced . Truecolor, or 24-bit RGB color support, was implemented in patch #314 on December 28, 2014, allowing precise specification of colors using 8-bit values for , green, and blue components. This is achieved with sequences such as CSI 38;2;255;0;0m for pure foreground, and palette modifications via OSC 4;1;rgb:ff/00/00 to set direct 1 (Ps=1) to that RGB value. The directColor resource (default: true for visuals with at least 8 bits per color), facilitates this by leveraging capabilities or a 256-entry colormap. Configuration of colors occurs primarily through X resources, with XTerm*color0 through XTerm*color15 defining the standard ANSI palette (e.g., color0 as , color7 as light gray), and XTerm*colorBD specifying the color for bold text, defaulting to the foreground color. The boldColors resource, true by default, maps dim colors 0-7 to bright 8-15 for bold attributes, while colorMode toggles ANSI color support overall. Runtime changes are possible using OSC 4 sequences to adjust palette entries dynamically. In practice, xterm's color features enhance shell prompts—such as coloring usernames in PS1 with $$\e[31m$$—and editor syntax highlighting, as in Vim, which activates 256 colors upon detecting $TERM=xterm-256color and truecolor with set termguicolors. This progression from the original monochrome display to full RGB support maintains backward compatibility, as basic 16-color mode remains the default and extended features operate within X resource limits without breaking legacy applications.

Advanced Features

Input Protocols

xterm handles keyboard input through standard VT100-compatible mappings, emulating the behavior of DEC VT102/ terminals for keys such as cursor movement, function keys, and editing operations. These mappings include normal and application cursor keys, configurable via resources like appcursorDefault (default false) and backarrowKey (default true, sending ). xterm extends this with support for modified keys, such as combinations, reported using the u sequence format introduced in patch #366 (2021). This extension allows applications to distinguish modifier states (e.g., Shift, , ) in key reports, enhancing compatibility with modern editors and shells. For mouse input, xterm supports several tracking protocols to report button presses, releases, motion, and events to the host application. The DEC SRM (Select Report Mouse) mode 1000 provides basic mouse reporting for button and position events. More advanced is the SGR (Select Graphic Rendition) mode 1006, added in patch #120 (1999), which offers precise coordinate reporting up to 223 columns and rows, including support for scrolling (buttons 4 and 5) and drag operations. Mouse reporting becomes aware starting with patch #200 (2005), ensuring proper encoding of event sequences in internationalized environments. Configuration options fine-tune input handling. The XTerm*allowSendEvents resource (default false) permits interpretation of synthetic events from XTest extensions, useful for automated input testing but disabled by default for reasons. The eightBitInput resource (default true) enables direct insertion of 8-bit characters, including in mode when the supports it, and can be toggled at since patch #216 (2006). Additionally, modifyOtherKeys (levels 0-3, default 0) controls extended key reporting, with level 3 using u for full modifier support. These input protocols are particularly valuable in applications like and vim, where enabling mouse modes (e.g., via set mouse=a in vim or set -g mouse on in ) leverages xterm's reporting for features such as pane selection, , and text manipulation. Detection of xterm's capabilities often relies on the $[TERMINFO](/page/Terminfo) database, which provides terminfo entries describing supported sequences like those for mouse modes.

Security Mechanisms

xterm provides session capabilities to record activity, serving as a basic for monitoring and reviewing user interactions. The -l option enables of all input and output to a file, which is toggled via the main or the set-logging action, while the -lf filename option specifies a custom log file path, defaulting to a timestamped name like Xterm.log.[hostname](/page/Hostname).yyyy.mm.dd.hh.mm.ss.XXXXXX if none is provided. Additionally, the XTerm*saveLines , configurable via the -sl number command-line option, determines the size of the scrollback in (default 1024 lines), allowing users to retain and review recent output without immediate file persistence, though full session logs via -l or -lf capture comprehensive activity for auditing. To mitigate risks from unauthorized X protocol interactions, xterm includes restrictions on certain operations, such as the disallowedWindowOps resource that blocks specific manipulations like GetChecksum for character checksums in rectangles, enhancing protection against potential exploits via extensions like XTest. The allowTerminationAction resource further secures sessions by controlling whether termination actions, such as quit commands from the , are permitted, preventing unintended or malicious shell escapes that could terminate unexpectedly. These permissions integrate with broader X by limiting allowable operations, ensuring that only authorized actions affect the terminal environment. Visual and audible alerts in xterm are configurable to avoid deceptive notifications, with the visualBell (enabled via -vb) flashing the instead of sounding a bell, reducing risks from attempts that rely on urgent window flashing. The bellIsUrgent sets an urgency hint to the upon bell activation, notifying users of important events without relying solely on audio, while visualBellDelay (default 100ms) and bellSuppressTime (default 200ms) prevent excessive alerts that could desensitize users or mask security warnings. In modern versions, logging enhancements support capture of advanced control sequences, including truecolor (24-bit RGB) specifications via OSC (Operating System Command) escapes, allowing administrators to detect anomalies in color-related inputs that might indicate injection attempts or unauthorized modifications. This builds on core to provide detailed forensic data for , with logs preserving escape sequences for post-session review.

References

  1. [1]
    XTERM(1) manual page - X.Org
    The xterm program is a terminal emulator for the X Window System. It provides DEC VT102/VT220 (VTxxx) and Tektronix 4014 compatible terminals.
  2. [2]
    XTERM – Terminal emulator for the X Window System
    It was originally developed in the mid-1980s to provide DEC VT102 and Tektronix 4014 compatible terminals for programs that cannot use the window system ...
  3. [3]
    XTerm – Frequently Asked Questions (FAQ) - invisible-island.net
    To give a bit of history, xterm predates X! It was originally written as a stand-alone terminal emulator for the VS100 by Mark Vandevoorde, as my coop student ...<|control11|><|separator|>
  4. [4]
    GettingStarted - X.Org
    Sep 15, 2013 · xterm. "xterm is the standard terminal emulator for the X Window System. A user can have many different invocations of xterm running at once ...
  5. [5]
    XTerm
    XTerm. Developed and maintained since 1986. About. XTerm is the standard terminal emulator application for the X Window System (X.org).
  6. [6]
    [PDF] VAXstation 100 USER'S GUIDE - Bitsavers.org
    The VAXstation 100 expands the utility and convenience of the VAX/VMS operating system by providing each VAXstation user with as many terminals (simulated on ...
  7. [7]
    XTERM - Change Log - invisible-island.net
    Here is the latest version of this file. It began as a list of the changes that I made for xterm, using the notes that I added when submitting a patch.
  8. [8]
    Index of /archives/xterm - invisible-island.net
    Index of /archives/xterm ; [TXT], koi8-term, 2007-03-16 07:12 ; [DIR], old-xterm-patches/, 2020-02-17 06:59 ; [DIR], patches/, 2025-10-19 20:27 ...
  9. [9]
    xterm package versions - Repology
    List of package versions for project xterm in all repositories.
  10. [10]
    xterm(1) - invisible-island.net
    The xterm program is a terminal emulator for the X Window System. It provides DEC VT102/VT220 and selected features from higher-level terminals.
  11. [11]
    terminfo for XTERM - invisible-island.net
    # Since patch #280 2012/06/24, xterm by default reports itself as a VT420. # This generic building-block matches ncurses. report+da2|report secondary device ...
  12. [12]
    ctlseqs(ms) - invisible-island.net
    XTerm supports control sequences for manipulating its window which were implemented by Sun's shelltool program. This was part of SunView (SunOS 3.0, 1986).
  13. [13]
  14. [14]
    xterm manpage
    The xterm program is a terminal emulator for the X Window System. It provides DEC VT102/VT220 and selected features from higher-level terminals such as VT320/ ...
  15. [15]
    xterm(1)
    Below is a merged summary of the X Resources in xterm, combining all information from the provided segments into a concise yet comprehensive response. To maximize detail and clarity, I’ve organized key information into tables where appropriate (in CSV format for density), while retaining narrative sections for overview, precedence, and examples. All URLs are included at the end.
  16. [16]
    Getting Started · tmux/tmux Wiki - GitHub
    tmux has rich support for the mouse. It can be used to change the active pane or window, to resize panes, to copy text, or to choose items from menus. Support ...<|control11|><|separator|>