How can I get raw text output of a manual in my terminal
Solution 1
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
Solution 2
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
Solution 3
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...
Solution 4
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
![user123456](https://lh6.googleusercontent.com/-ps7DZsfsRIw/AAAAAAAAAAI/AAAAAAAAAoU/9owa9No7vj4/photo.jpg?sz=256)
user123456
Updated on September 18, 2022Comments
-
user123456 almost 2 years
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.
-
edwinksl almost 8 yearsWhat do you mean "raw text output"? There is a
-t
option to format the man page withgroff
.
-