Navigate the man pages
I often need to look up commands and their respective options. Normally, I would google my question. Let me give three recent examples from this morning:
- "How to set path with wget"
- "What is the d option in unzip?"
- "adduser gecos"
Eventually I will find a post on stackoverflow or another stackexchange website that delivers good answers. One of these answers has changed my behaviour. I knew about the man pages, but I have found it always rather cumbersome to skim through the man pages. I now learned how it can actually be easy to navigate the man pages.
As "Radu Rădeanu" answered in 2014, type /<word>
to highlight every "word" in the man page, and press n
to go to the next occurence. That's a really nice feature of the man page, and I think it's worth investing more time into getting man page behaviours straight. Thank you, Radu!
/word
-> search "word" after the cursor?word
-> search "word" before the cursorn
-> Go to next occurence of wordN
-> Go to previous occurence of wordd
-> Go downwards half a pageu
-> Go upwards half a page
If you search an option like -s
, you will find it really difficult to find the description of your command. You can try it in man curl
: You will find way too many highlights and be ineffective in your search.
In that case, you can use a regex / regular expression:
# search for -s; . -> any number; * -> any character; --
/-s.*--
man cp # open the manual page for the cp command
/-d # search "-d" inside the man page
n # go to the next occurence of "-d"
n # ...
N # go to previous occurence of "-d"
?-r # Look for occurences of "-r" before the cursor