3

When viewing a manpage say man ls, how does one search the content of the man page? (similarly, in vim you can call :/search_string what is a comprable command while viewing a man page?)

rudolph9
  • 8,021
  • 9
  • 50
  • 80
  • 1
    have you tried grep: man ls | grep thestringtosearchfor – lnu Feb 15 '12 at 20:49
  • I don't what changed but trying exactly what I wrote in my question I am able to search the content? Maybe an update as part of the Mac OS 10.7. – rudolph9 Feb 15 '12 at 21:03

2 Answers2

3

It depends on which pager you use, which depends on your MANPAGER/PAGER environment variable. The manpage of man says:

If MANPAGER is set, its value is used as the name of the program to use to display the man page. If not, then PAGER is used. If that has no value either, /usr/bin/less -is is used.

Note that on Debian unstable the default is pager -s (managed by alternatives). So, if you actually are using less, just type /searchstring, similar to vim. See also the manpage of less on how to navigate in less.

Alex P.
  • 760
  • 5
  • 6
2

On Ubuntu (and probably similar distributions), you type "/" followed by what you want to search for

Example:

/word

Pressing "n" jumps to the next hit

Optimist
  • 387
  • 1
  • 5