5

man defaults to using a pager. For short pages, I want to just echo them to the terminal without paging. I'm on OS X. Things I've tried:

man -t man                  #produces PostScript output
man man | groff -T latin1   #readable, but line wraps badly
man man | troff -a          #readable, but ... interesting ...
man man | echo              #no output

Better offers?

4
  • you can try setting MANPAGER= (ie empty) in the env.
    – meuh
    Sep 12, 2015 at 13:38
  • At least on OS X that results in an error message when you try to man something Sep 12, 2015 at 15:38
  • sorry, dont have an OS X to try it on. Perhaps MANPAGER=cat ?
    – meuh
    Sep 12, 2015 at 15:41
  • Yes, that worked. For my needs though, Arjan's answer is good. Sep 12, 2015 at 15:49

3 Answers 3

4

You won't get formatting, but you can set the pager to be simply cat:

man man -P cat

Also, man won't format when piped, which is why the following gets you the same result:

man man | cat
2
  • Perfect, dankuwel! Sep 12, 2015 at 15:36
  • So that got me to function mann { man $@ | ul ; } in my profile Aug 3, 2021 at 23:12
3

To expand on on Arjan's Answer, you can get formatting using cat as a pager if you pipe it to ul:

man foo -P cat | ul
3

I fact I went a different route because I realised my 'real problem' was with less clearing the screen on exit. I put

export MANPAGER='/usr/bin/less -isXF'

in my startup profile. The -X parameter means that when I quit less, whatever part of the man page was on screen, stays there.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .