Terminal Command Line – Copy All Text of an Entire ‘man’ Page from Terminal

command linecopy/pastemanterminal

I am reading a very long man page (man ssh). I want to save all of that text for more convenient reading in a text-editor.

Unfortunately, choosing either of :

  • Edit → Select All → Copy

  • Shell → Export Text As…

results in saving only a screen-full of the text, not all the text that scrolled by.

How do I extract the text of an entire man page?

Best Answer

You can push plain text to the clipboard by piping to pbcopy, to paste anywhere as usual.

man ssh | col -b | pbcopy

or equivalent

man -P "col -b | pbcopy" ssh

the latter of which is nicer if you want to use it as an alias, like mancp ssh, given:

alias mancp='man -P "col -b | pbcopy"'

There are methods to go to HTML/PDF: Can man pages be converted to html and/or pdf format?


If it's just the nicer reading experience you're after, you can right-click on a selection of a command and open its man page as a separate window/tab, with normal scrolling and ⌘F find.

Nicer reading

You can customise what this looks like in Terminal Preferences → Profiles, under the Man Page profile which is one of the default profiles to exist.
This includes font family and size (also see View menu) and background/foreground colours.

Man Page profile preferences