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.
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
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
man 2 fork:
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 -
/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...
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