Search code examples
sshmanpage

How can I search the man pages?


I need to find a an option for ssh but the listing is to long when I do

man ssh

It appears that the man page is being opened in an editor of some kind and there is a colon prompt.


Solution

  • On a standard configuration (pagertype) you can enter a slash / and then the text you search for.

    After searched for a text, press n for further occurences of the text.

    Edit

    It is not recommended to open a man page in an editor. You had to force the editor to read the man page text from stdin. e.g. for nano this feature is added in newer versions (>2.2 ?) only. And also if the stdin is redirected the groff control sequences which are reponsible for formatting the pages, won't work. And an editor is not a pager, i.e. space-key prints a white space charater and does not move to the next page.

    But theoretically you can setup the environment variable $PAGER with export PAGER="<your pager/editor>" (on a bash-like shell). e.g. for nano export PAGER="nano -".