3

I find the manuals very difficult to read using the terminal. Is there a way to highlight specific text on the terminal? I tried piping to gedit using man man | gedit, but it opens a blank file instead.

Perhaps there's some way to find text within a man page and have it highlighted?

slm
  • 369,824

2 Answers2

3

Dumping to clear text

You can use this technique to dump a man page out to a text file.

$ man -P cat ls > manpg_ls.txt

The above technique is just changing what pager man uses. Here we're telling it to use the cat command instead. We then get the man page for the ls command dumped to a file in clear text.

Example

Here's the first 10 lines of the ls man page.

$ man -P cat ls | head -10
LS(1)                                                              User Commands                                                             LS(1)



NAME
       ls - list directory contents

SYNOPSIS
       ls [OPTION]... [FILE]...

Searching

Another approach is to use alternative pager commands and functions to search through man pages. Several techniques are covered in this U&L Q&A, titled: Reading and searching long man pages.

slm
  • 369,824
  • Thank you. I managed to find a simpler solution after pressing h for help. Sharing it here with everyone. – Question Overflow Jan 18 '14 at 08:13
  • @QuestionOverflow - re-read the link I gave you, the /some along with other techniques is covered over there. – slm Jan 18 '14 at 13:14
  • Indeed, I have to read that post the third time to realise that my answer could be found in the question itself because I misinterpret read to be some command. – Question Overflow Jan 19 '14 at 02:26
0

I managed to find a much simpler solution:

Once you have entered man page, type:

/some text

It does a case-insensitive search and highlight all occurrences of "some text". You can just page up or page down to scroll through the entire man page after that.

  • And if GNU less is your pager, you can type a Ctrl-K after the / to do the search in "Keep position" mode - it will highlight the matches without jumping ahead. –  Jan 18 '14 at 16:55