What is the name of the formatting output from man?

The method is called overstriking or overtyping, and goes back to the days of typewriters.

Byte 0x08 (aka \x08 or ^H) is the ASCII "Backspace" character. With typewriters and line-printers, it would move the cursor back one character, so the following character would be printed on paper at the same position as last one. Most commonly, either a character is overstruck over itself (resulting in bold text), or over an underscore _ (resulting in underlined text).

Computer terminals normally also delete the backspaced-over character, so this method would no longer work. However, many pagers such as less (the default pager used by man) or w3m automatically translate the two cases mentioned above into actual bold/underline formatting.

(See also ASA carriage control characters used by mainframes and line printers; they have an "overstrike last line" option instead of using Backspace.)

Compare this to combining characters found in Unicode.


That's plain ASCII, nothing special about it. The \x08 is ASCII code for backspace so the first one does H-backspace-HE-backspace-E... (writes every character twice) and the second does H-backspace-_ and so on. It's what you would do on a typewriter to get bold and underline.

On the other hand, to handle color, you output ASCII escape codes that are interpreted by the virtual terminal to show color, blink, position cursor and so on. It's how commands like ls write in color:

http://en.wikipedia.org/wiki/ANSI_escape_sequences

To allow less to preserve the ASCII escape codes, you call it as less -R. For instance, this command displays ls output in color in less:

/bin/ls --color -B -F -1 | less -R

Which I have as alias to lsl.

Tags:

Man