How can I get raw text output of a manual in my terminal?

I want to have the manual without a "less" type screen displayed.

  • 2
    What do you mean "raw text output"? There is a -t option to format the man page with groff. – edwinksl Sep 26 '16 at 6:16

You can change the pager to cat using the -P option:

man -P cat command

where command is the command of interest whose man page you wish to read.

You can also redirect the man page to a file which you can then open to read:

man command > file

You can directly read the compressed (could be uncompressed too) man files, residing under /usr/share/man/ in directories corresponding to respective sections.

So for example, to get the raw content of man page of cat, you need to read /usr/share/man/man1/cat.1.gz:

zcat /usr/share/man/man1/cat.1.gz 

Similarly, for man 2 fork:

zcat /usr/share/man/man2/fork.2.gz

If you want a text format, AND you don't want those pesky "page separators" everywhere in the document, a way is:

zcat /usr/share/man/en/man1/man.1.gz | groff -m man -rcR=1 -T ascii -

(change /usr/share/man/en/man1/man.1.gz to the manpage you are looking for. This is is the man page for man (same as : man man, but without the page separators)

There is a way to do a custom man command that does the same for you, but I can't test it right now...


Redirecting man's output (as suggested in other answers) should work as expected. man detects that its output is not a tty, so it avoids printing appropriate escape characters that would otherwise provide italics, bold and other formatting.

As a more general answer, you can use col -b to strip such characters from the output of any command. Not all commands are as smart as man and might not detect that their output is being redirected. In other words, you could have done something like:

man command | col -b > somefile

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.