esc-m
Move cursor one word backward
SYNOPSIS
This is not a standalone command but an escape sequence. Its general form is:
ESC[Ps;...;Psm
where ESC represents the ASCII Escape character (decimal 27), [ is the Control Sequence Introducer (CSI) indicator, and Ps are one or more numeric SGR (Select Graphic Rendition) parameters, separated by semicolons. The sequence concludes with the character m.
PARAMETERS
0
Resets all attributes (bold, colors, etc.) to their default state.
1
Sets the font to bold or increased intensity.
2
Sets the font to faint or decreased intensity.
3
Sets the font to italic.
4
Applies an underline to the text.
5
Enables blinking text.
7
Swaps foreground and background colors (reverse video).
8
Hides text (foreground color is same as background).
9
Applies a strikethrough to the text.
21
Disables bold or faint (often paired with 1 or 2).
22
Disables bold or faint for standard intensity.
23
Disables italic.
24
Disables underline.
25
Disables blinking.
27
Disables reverse video.
28
Disables hidden text.
29
Disables strikethrough.
30-37
Sets standard foreground colors (black, red, green, yellow, blue, magenta, cyan, white).
40-47
Sets standard background colors (black, red, green, yellow, blue, magenta, cyan, white).
90-97
Sets bright foreground colors.
100-107
Sets bright background colors.
38;5;N
Sets 256-color foreground, where N is 0-255.
48;5;N
Sets 256-color background, where N is 0-255.
38;2;R;G;B
Sets truecolor (24-bit) foreground using RGB values.
48;2;R;G;B
Sets truecolor (24-bit) background using RGB values.
DESCRIPTION
The term "esc-m" most commonly refers to the final character 'm' within an ANSI escape sequence used for Select Graphic Rendition (SGR). This sequence, typically starting with an Escape character (represented as \033 or \e) followed by [ and one or more numeric parameters, is not a standalone Linux command but rather a control sequence interpreted by terminal emulators. Its primary purpose is to modify the appearance of text displayed in the terminal, such as setting foreground and background colors, applying bold or italic styles, underlining, or resetting attributes. Programs and shell scripts use these sequences to produce colored or styled output, enhancing readability and user experience. Understanding these sequences is crucial for advanced terminal customization and script development.
CAVEATS
The interpretation and support for specific SGR parameters (especially advanced features like truecolor) depend entirely on the terminal emulator being used. Not all terminals support all attributes or color depths. These sequences are raw byte streams and are typically embedded within strings printed by commands like echo -e or printf. Incorrectly formatted or unsupported sequences may lead to unexpected terminal behavior or display garbage characters.
USAGE EXAMPLES
To apply text attributes, these sequences are usually printed to the terminal. For example, to print 'Hello' in bold red, then reset:
echo -e "\033[1;31mHello\033[0m"
Here, \033 is the escape character, 1 is bold, 31 is red foreground, and 0 resets attributes. The -e option for echo enables interpretation of backslash escapes.
ALTERNATIVE: TPUT
For a more portable way to control terminal attributes, especially in shell scripts, the tput command is recommended. It queries the terminfo database for terminal capabilities and outputs the correct escape sequences, abstracting away the raw ANSI codes. For instance, tput setaf 1 sets foreground red, and tput sgr0 resets attributes.
HISTORY
ANSI escape sequences, including the SGR parameters ending in 'm', originated from the ECMA-48 standard (Control Functions for Coded Character Sets) first published by ECMA (European Computer Manufacturers Association) in 1976. This standard became widely adopted, especially after its incorporation into various terminal emulation protocols (like VT100). The specific 'm' ending for graphic rendition commands is a key part of this legacy, providing a standardized way for applications to control terminal appearance across different systems, including Linux environments. Its consistent usage has made it a fundamental building block for interactive command-line interfaces.