ul
Underline text
TLDR
Display the contents of the file with underlines where applicable
Display the contents of the file with underlines made of dashes -
SYNOPSIS
ul [options] [file...]
PARAMETERS
-i
Do not use the terminal's native underline capability. Instead, force the use of the overstrike method (e.g., outputting _
then \b
then the character) even if the terminal supports direct underlining via control sequences.
-t type
Override the terminal type specified by the TERM
environment variable. This is useful for testing how output would appear on a different type of terminal.
DESCRIPTION
The ul command processes text input, typically from files or standard input, and converts specific escape sequences or character combinations into visual underlining. Historically, many terminals lacked direct hardware support for underlining characters. Instead, applications like text formatters (e.g., nroff, troff) would produce output where an underscore character (_) was overstruck with a backspace (\b) followed by the character to be underlined, or vice-versa. ul intercepts these patterns and translates them into appropriate control sequences that a terminal can interpret for underlining (e.g., using special character modes, or by repeating the overstrike method if the terminal truly has no native underline support).
While highly relevant in the era of early character-based terminals, ul's utility has significantly diminished with modern terminal emulators, which typically support ANSI escape codes (SGR 4) for direct underlining. Consequently, ul is often not installed by default or is considered an obsolete utility.
CAVEATS
The ul command is largely obsolete for modern computing environments. Most contemporary terminal emulators (like GNOME Terminal, Konsole, xterm, iTerm2, etc.) fully support standard ANSI escape codes for underlining (SGR 4), making ul's translation services unnecessary. Its primary use case was with older, less capable hardware terminals. As such, ul may not be installed by default on many Linux distributions, or its behavior might not be immediately apparent when piping output from modern tools that directly produce SGR codes. Using ul with output that already uses SGR codes might lead to unexpected or no visible changes.
TYPICAL USAGE
ul is typically used in a pipeline with text formatting commands that generate overstrike sequences for underlining, such as nroff or troff. For example:
nroff -ms document.ms | ul
This command would format 'document.ms' using the nroff formatter and then pipe its output through ul to correctly display any intended underlining on older terminals.
MODERN RELEVANCE
In modern Linux environments, applications and shell utilities typically output ANSI escape codes (SGR parameters) directly for text attributes like bold, underline, and color. These codes are natively understood by contemporary terminal emulators. Therefore, ul is rarely needed today and might even conflict or produce no effect if the input already contains modern escape sequences.
HISTORY
The ul command has its roots in early Unix systems, specifically originating from BSD (Berkeley Software Distribution) Unix. It was developed to address the display limitations of text-only terminals of the time. These terminals often lacked dedicated hardware features for graphical attributes like underlining, bolding, or inverse video. Text formatting systems like nroff and troff would generate "overstrike" sequences (e.g., a character followed by a backspace and an underscore) to achieve the effect of underlining. ul served as a filter to interpret these sequences and render them visually, either by utilizing rudimentary terminal capabilities or by converting them into alternative emphasis methods. Its importance waned as more sophisticated terminal hardware and later, software emulators, became standard, incorporating direct support for advanced text attributes via escape sequences.