How can I use man without less?

By default, man uses less to output text. How can I tell it to just output to stdout? My terminal emulator has a scroll bar and search function and I want to use those instead of the arrow keys.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Actually it uses whatever is specified in the MANPAGER or the PAGER environment variable.

Depending on your man implementation and version there could be also a command line switch to specify the pager.

With the man-db implementation I use all the below ways work:

MANPAGER=cat man man

PAGER=cat man man

MANOPT='-P cat' man man

man -P cat man

To set it permanently, just add it to your ~/.bashrc (or other initialization file used by your shell):

export MANPAGER=cat

That works with some older man implementations too, while MANOPT is man-db specific:

export MANOPT='-P cat'

(Better do not set PAGER that way. That one is used by many other applications too.)

There could be also a global configuration file. man-db has /etc/man_db.conf or /etc/manpath.config. There you can set:

DEFINE    pager    cat

But unfortunately that is taken in consideration only if neither MANPAGER nor PAGER is set.

Method 2

Simply pipe the output of man to cat?

man ls | cat   # useful use of cat

Method 3

Try these commands to generate man output without a pager.

  • man ls | cat (generated fixed width)
  • man -P cat ls (generated variable width)

I was on a GNU linux system

Method 4

Another angle: Similar to Tony’s answer.

You can also redirect man output into a file and view it with your favorite text editor or even add bookmarks, comments, etc. to it.

man bash  > bashman.txt

I have a copy of the bash man page as well as just the sections on bash flow control and bash test flags saved as text files in my bin directory so I can load them right into my text editor (kate) for reference while I’m writing bash scripts.


Warning: depending on your system and the man page, the above command may result in formatting information and control characters in the file.

To avoid this, do as suggested in LESS='+/^TIPS' man man:

To  get a  plain  text  version  of a man page, without backspaces and
underscores, try

  # man foo | col -b > foo.mantxt


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x