2

I was trying to render the troff file https://github.com/bit-team/backintime/blob/master/common/man/C/backintime-config.1 in terminal.

How can I make the output (using cat or some other utility) look like the way man outputs troff file in the terminal?

Do I need to convert the troff file to some format understood by the terminal?


Note: I am not looking to export it to pdf or html

2
  • The question does not specify an operating system, and man built upon groff exists on at least (older) FreeBSD and Linux-based operating systems.
    – JdeBP
    Jul 7, 2020 at 16:27
  • I'm really unfamiliar with the subject, but groffer --tty your_file is probably an easy way. (I see that groffer is provided by the groff package on Ubuntu, which is likely not installed by default).
    – fra-san
    Jul 7, 2020 at 18:14

2 Answers 2

2

Just do

man "${Path-To-Troff-File}" 
1
  • It's not that simple. With some implementations of man this only works if the path contains a directory prefix.
    – JdeBP
    Jul 7, 2020 at 16:25
0

Another option (depending on system): use the groff tool with the appropriate troff post processing macro for output to a TTY device, e.g. utf8.

# To stdout
$ groff -man -T utf8 file.1

# From archive via pipe
$ zcat file.1.gz | groff -man -T utf8 -i

# Pass to less
$ groff -man -T utf8 file.1 | less -R
...

One can use grog to detect what macro to use, and optionally execute by using --run and passing options to groff. For example:

$ grog file.1
groff -man file.1
$ grog --run -T utf8 file.1
groff -T utf8 -man file.1
[DOC]
...
  • groff - front-end for the groff document formatting system.
  • grog - guess options for a following groff command.

  • groff_tmac - macro files in the GNU roff typesetting system.
  • groff_man - compose manual pages with GNU roff.
  • grotty - groff driver for typewriter-like devices.
  • nroff – use groff to format documents for TTY devices.
  • troff - the troff processor of the groff text formatting system.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .