After downloading the source code for Bash, I was browsing through the doc directory and came across the following files:

These control characters are not displayed in the representation provided by the Git web interface but the actual file can be downloaded and examined in text editor such as Vim.

Running the file command on bash.0 prints the following output:

bash.0: ASCII text, with overstriking

I’ve never come across this file format before and I was wondering what its purpose is and how it’s used. Searching the Web for the phrase “ASCII text, with overstriking” hasn’t been very enlightening.


A web search for "backspace" and "overstrike" would get better results.

The file is a manual page — formatted using nroff. Usually files such as bash.0 are simply generated and discarded. A while back, they were saved, to reduce work for the man program. Rather than /usr/share/man/man1, your manual pages would be read from /usr/share/man/cat1. Read the description of catman for instance.

nroff is the Unix command for formatting manual pages and other files. Back when it was first written, there were several other utilities, each with its own markup language. I've used at least a dozen different ones. But they all solved the problem of printing emphasized text in the same way: using carriage control. Backspaces are just noticeable because they are not used in other plain-text files. Tabs, carriage returns, line-feeds and form-feeds all have a role in plain text files (though form-feeds are far less important than they were originally).

nroff uses underlining to indicate italics and overstriking to represent bold. The technique is dated: it is useful for hard-copy devices where more than one character can be printed in the same position. Very few video terminals do that. In terminfo(5), that would be

   over_strike               os     os   terminal can over-

or more completely:

If the terminal overstrikes (rather than clearing a position when a character is struck over) then it should have the os capability.

In the usual case, the last character written on a given row/column of a video terminal would be all that is shown. nroff organized the output so that an underlined character was written as an underline, a backspace and the actual character. Doing that ensured that terminals without the overstrike feature would print something useful.

Among the very few video terminals listed which have the overstrike capability, I see the DEC gt40, which I used for about three years (1976-1979). There was no Unix on that system (it ran RT-11), but I wrote a text formatter, using the same type of overstruck text. Ultimately, I needed hardcopy, and wrote a utility to make that happen — something like col, perhaps — but solving a related problem. The terminal printed very slowly when it had a lot of underlined text, until my program reorganized the text to reduce the amount of switching between forward/backward motion.

With video terminals, there is no need for that. But they do not do overstriking. Instead, we have programs that recognize the underlining and show underlines, or have groff, which might show colored text instead of underlining (and bold).

Further reading:

  • Thanks for the comprehensive answer with interesting historical background. It's late at night for me so I'll read it properly tomorrow. FWIW, I actually upvoted your answer on generating man pages earlier today when I was researching the *roff family of text formatters. – Anthony Geoghegan Apr 6 '16 at 23:05

Overstriking is a method used in nroff (see the Troff paper) to offer more typographical possibilities than plain ASCII would allow:

  • bold text (by overstriking the same character)
  • underlined text (by overstriking _)
  • accents and diacritics (e.g. é produced by overstriking e with )

and various other symbols, as permitted by the target output device.

In bash, these .0 files are produced directly by nroff, with Makefile rules such as

        $(RM) $@
        -${NROFF} -man $< > $@

You can view such files using less; it will process the overstriking sequences and replace them as appropriate:

less bash.0

Originally nroff's output targeted typewriter-style output devices, which would back up every time they received a backspace character; overstriking would produce the desired visual output. As pointed out by chirlu, striking the same character twice would usually result in a bolder appearance thanks to the inevitable misalignment of the successive strikes; the increase in the amount of ink deposited would also help.

(troff targeted typesetting machines.)

  • Thanks for the link to the Troff User's Manual and the information on how the files are produced. In my question, I also asked how these files are intended to be used. I tried running nroff bash.0 on my Ubuntu system but it produced a number of warnings, the output was hard-wrapped at 65 characters and there was no special formatting. – Anthony Geoghegan Apr 6 '16 at 11:28
  • 1
    Ah yes, I forgot that part; I've edited my answer. nroff is used to produce these files, not to view them. – Stephen Kitt Apr 6 '16 at 11:35
  • 2
    Yes, and that's pretty much how man bash works; it uses nroff -man to process the .1 file (or whichever section is relevant), which is an nroff file, before feeding it to the appropriate pager. – Stephen Kitt Apr 6 '16 at 13:36
  • 5
    @Anthony Geoghegan: The idea was that you would send this file to an impact printer, such as a daisy-wheel printer. It would actually print a character, then move back, then print the other character, with results as described above. The bold text is similar to a “chorus effect” in audio processing: The second character is very slightly misaligned with the first, leading to thicker lines. – chirlu Apr 6 '16 at 16:01
  • 1
    @chirlu That's a great explanation of how control characters were used to achieve typographic effects with legacy hardware. The use of those particular characters makes a lot of sense now. If you post this as an answer, I can upvote it properly. Edit: Stephen has already incorporated and expanded on this. – Anthony Geoghegan Apr 6 '16 at 16:10

And even earlier, it was a method of printing on golf-ball printers that worked like old typewriters and had a very limited set of characters that they could print. So nroff uses the byte stream of an old teletype printer to represent how to should look 'on screen'.

  • nroff actually was designed initially to print on typewriters, as opposed to troff which targeted typesetters. Using screens for output came later... – Stephen Kitt Apr 6 '16 at 13:56
  • 9
    I'm old enough to have used a mechanical typewriter where you typed ! by typing ' BACKSPACE . – Barmar Apr 6 '16 at 17:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.