Just as I was wrapping up an email and getting ready to leave work, a co-worker rolled his chair over to show me an â€œinterestingâ€ thing. He was in Terminal, looking for documentation on a new feature, and had been told that it only existed as a Unix â€˜manâ€™ page. He wanted to email it to somebody so heâ€™d used the Terminal feature to capture output to a file, and had opened it in a text editor, but in the text file the title of the command and certain words in the text had ddoouubblleedd cchhaarraacctteerrss.

And forty years of my life dissolved away as into a mist, like I had nibbled on Proustâ€™s madeleine. And I laughed and cried at the same time (Reply to this post if you know where this is going). Of course, I told him, Terminal is a tty, and man thinks that itâ€™s a Decwriter from 1975. It is printing char-backspace-char to make it bold Terminal simulates the overstrike. But when itâ€™s copied to a file itâ€™s just 0x08 and nonprinting, and you see the doubled characters.

But I remembered, from 1997 when NeXT came in, or 1987 when I managed A/UX, or 1977 when I troffed the Apple II Reference Manual that the man page for man had the instructions for how to stop this. A flag? Redirecting standard out to a non-tty pipe? â€˜man manâ€™ it isâ€¦ And though the man page has changed a lot in 40 years, it was still there. | col -b > filename.txt to strip the doubled characters. With also the magic words â€œreverse line feed.â€ Ah! Pinfeed perforated paper on a letter-quality printer!

See, there were these rollers with pins on them that fed the paper. But to tear off the last page the perf needed to be above the pin feed. That left 2â€ unused so if your top margin was less than that, it needed to inject a Form Feed, then six lines of Reverse Line Feed to print the top of the page but if you were piping to a text file the reverse line feeds would just overprint the last lines on the previous page. col filtered them out.

The memory of years of fussing with pinfeed paper and RIBBONS for Godâ€™s sake and top alignment and that in 2017 all that code is still there but the main point is that it being a living document we have no idea of what it originally said without the edit history.

That was a fun, if not entirely surprising read. Having worked as a teletype operator right out of high school (yes, the actual teletype machines with green screens and line printers), this was where I expected it to go.

Luckily, there are convenient ways to automatically transform manpages into pure ASCII text (no more highlighting, reverse, underlining) or to PDF, especially because PDF is a very popular document exchange format.

Of course, as we’re talking about UNIX here, it’s easy to create a “wrapper” around that mechanism so you can simply write something like

% man2pdf 2 open

and the script replies with

/tmp/open.2.pdf

which you can select and copy into your e-mail “attach file” dialog. Send the file, and the reader will benefit from a pleasantly formatted text document. Oh, and the recipient can print it, because people love printing stuff. 😉

Adding a PDF (pre)viewer into the mix is trivial.

Of course if you only want to copy parts from a manpage, simply select the text with the left mouse button inside the terminal, switch over to your mail composing window, press the middle mouse button (or wheel, or left+right button, depending on your mouse’s capabilities) to simply paste the text.

No “double-printed” characters.

(NB: “the terminal”, generic term, not “Terminal”, because due to technology advancement, this might not work anymore.)

Having worked as a teletype operator right out of high school (yes, the actual teletype machines with green screens and line printers), this was where I expected it to go.

When I read “actual teletype”, I imagine a real teletype like the T-51, the F1200 or F2000 built by RFT. Non-german persons probably know the famous Model 33 / ASR-33 as one of the first means to interact with UNIX computers. No fancy screen, and very limited output speed.

When I read “actual teletype”, I imagine a real teletype like the T-51, the F1200 or F2000 built by RFT. Non-german persons probably know the famous Model 33 / ASR-33 as one of the first means to interact with UNIX computers. No fancy screen, and very limited output speed.

Luckily, there are convenient ways to automatically transform manpages into pure ASCII text (no more highlighting, reverse, underlining) or to PDF, especially because PDF is a very popular document exchange format.

I wouldn’t consider most of your examples to be “convenient”. I recall piping the output of man to nroff, but that’s a really old memory.

I wouldn’t consider most of your examples to be “convenient”. I recall piping the output of man to nroff, but that’s a really old memory.

Personally, I find that

man ls > ls.txt

is all I need to do under my current bash environment.

When I do this in my (home) UNIX environment (not Linux, not bash), I get a text file with control characters (the ^H as backspace for “overprinting” as well as the double characters and the _ underlining). Example line:

-^H-D^HD _^Hf_^Ho_^Hr_^Hm_^Ha_^Ht

This is the text found in the text file for

-D format

Reading the file with “less ls.txt” again restores the look of the manpage including highlighted and underlined characters, in this example, “-D” printed bold, and “format” underlined. Outputting it with “cat ls.txt” directly to the terminal does not display the control characters – normal text is written to the terminal. But they are still there – “cat ls.txt | less” leads to the “manpage style” again.

It might be possible that in your environment the control characters are stripped automatically. Maybe your man’s roff implementation (nroff, groff, troff, etc) behaves different, maybe the shell changes $PAGER for the process to something else than the traditional “less” upon redirection…

It might be possible that in your environment the control characters are stripped automatically. Maybe your man’s roff implementation (nroff, groff, troff, etc) behaves different, maybe the shell changes $PAGER for the process to something else than the traditional “less” upon redirection…

I actually expected the behavior you saw– even did hexdump -C to verify there are no hidden control characters.

Interestingly, under FreeBSD, I get the behavior described above– control characters and double-characters for bold text.

You must be kidding you still have a working PDP-11, right? It was one of the first computers I had access on my uni, like ~33 years ago!

On a side note, I’m not surprise at all things like “double characters” and many other ancient capabilities are still around. On Unix world it used to be “if it is not broken ..”.

Many of us that connect remotely to fix/check things still prefer to use “character” terminals for fast and practical reasons and in this world esc, \b, \r and other special chars and sequences are still king, and fun to play with.

Yep. It’s like classic cars, plenty of us aa^Hdd^Hdd^Hii^Hcc^Htt^Hss^H enthusiasts out there that still run them. Granted you can emulate faster than real hardware, but part of the charm is restoring, running and operating these old girls. I have a few. Once you’ve moved in the circles, pdp-11 owners come out of the woodwork. Plenty around

There’s even modern extensions now days such as Bilquist’s BQTCP, Telnet, FTP, and web server (BQHTTP) for them. The old girls continue to run and be enjoyed. If you just want to emulate one, try simh as a starting point and see if you catch the bug. If you do, a cheap DECServer550 with the resistor and ROM hack is a cheap and easy entry-point.

Nobody commenting on why he’s using Twitter to discuss man overprinting? With the char limit, it ended up as 20 tweets in all – wrong social media platform methinks 🙂

Yep, your absolutely right. It’s the “in” social media platform, but for technical merit it leaves a lot to be desired. I lean towards more in depth discussion with good amounts of context, whereas twitter effectively undermines all of that.

On the other hand, I do think it’s the ideal platform for anyone with an aversion to detail, like presidents who like to talk alot yet actually have very little to say.

As other have said, the terminal being used isn’t handling the overstrikes. With that said, in their raw form, the roff man pages can be formatted for output proper to your end device. Shoot, you can even have it output HTML (with a few hiccups… depending on what your man supports).