In the manual of sudo
I need to search for -k
so I tried this:
man sudo | grep '\-k'
But it would result a paragraph be half-written on the output:
sudo -h | -K | -k | -V
Similar to the -k option, except that it removes the user's
-k, --reset-timestamp
Instead I tried printing the whole manual and color the search phrase with:
man sudo | grep '\-k\|$'
But since the manual page is too long, I can't scroll up enough to reach the beginning of the output (Note: I don't want to change the Scrollback lines in the profile settings of Terminal).
So I need to use more
or less
commands, to be able to reveal the output by page, so I tried:
man sudo | grep '\-k\|$' | less
But of course it doesn't work, because pipe runs the 2nd command on the 1st command.
Any idea how to redirect pipe?
Or make grep
print whole paragraph instead of one line? (the lines are based on Terminal's window size)
man sudo | grep -n "\|$" | grep 15:
very useful, it prints line 15 in the sudo manual page.