How can I 'cat' a man page like I would 'cat' a file to get just a dump of the contents?
First of all, the man files are usually just gziped text files somewhere in your file system. Since your milage will vary finding them and you probably wanted the processed and formatted version that man gives you instead of the source, you can just dump them with the
man tool. By looking at
man man, I see that you can change the program used to view man pages with the
-P flag like this:
man -P cat command_name
It's also worth nothing that
man automatically detects when you pipe it's output instead of viewing it on the screen, so if you are going to process it with something else you can skip straight to that step like so:
man command_name | grep search_string
or to dump TO a file:
man command_name > formatted_man_page.txt
Man pages are usually
troff pre-processed files, and you can get to the plain text with,
groff -t -e -mandoc -Tascii manpage.1 | col -bx > manpage.txt
groff is a wrapper for
You might need to use gzip to uncompress the man page files first, and you'll still have plenty of formatting information in the output.
I do this all the time. This command line makes me happy:
man man | col -bx > man.txt
col -b removes backspaces.
col -bx also replaces tabs with spaces which is my strong preference.
If I want the text to be formatted to a width of my preference while reading, then I change the command to this:
MANWIDTH=10000 man man | col -bx > man.txt