4

macOS has whois command available. Running it without any argument shows the following:

usage: whois [-aAbfgiIklmPQrRS] [-c country-code | -h hostname] [-p port] name ...

Here, the -c, -h, and -p options have description. However, no description is available for the rest of the shown options -aAbfgiIklmPQrRS.

How can I find the documentation for the same?

11

You can read the man page for whois command by running the following in the Terminal:

man whois

The man page for a command is the all-encompassing document, listing all the available options for the command. Man pages are generally available for all the available external commands. To locate installed man page(s) for a command, run the following:

man -aw <command>

To read a specific man page for a command, (in case more than one are listed on running the above) use the absolute path for the man page.


While viewing the man page for a command, you can use the following keyboard shortcuts to navigate:

  • j: Scroll down one line at a time.

  • k: Scroll up one line at a time.

  • f or Space: Scroll down one page at a time.

  • b: Scroll up one page at a time.

  • /search: To search for the keyword search. Use n to navigate to the next match.

  • q: Quit the man page viewer and return to the shell.

  • 1
    Addendum to the shortcuts: /search only searches forwards, and you can also issue empty / "searches" to go the next match. If you use ?search, you can search backwards, and bare ? goes to the previous match. / and ? inter-operate; after issuing either /search or ?search, both bare / and bare ? will use search. – HTNW Apr 23 at 17:21
  • 2
    Plus one for the mini-primer on how to use less. – fd0 Apr 23 at 18:09
  • While I agree with @fd0 , mentioning that this behavior is specific to less (and is essentially up to MANPAGER) might be worthwile – D. Ben Knoble Apr 23 at 22:50
12

Right-click on the name of the command and choose Open man Page
or ⌃⇧⌘? with the name of the command selected.

This opens the manual for the command in a new tab or window. You can browse this document using the scroll wheel as normal and perform regular operations like ⌘F for find.

This shortcut is also available on Touch Bar without needing to select the command name first.

Touch Bar screenshot

  • 3
    Holy crap, I never knew that, great tip! (Yeah I know this type of comment is frowned upon but just once maybe?) – Steve Chambers Apr 23 at 14:39
2

If you are keyboard ninja and do not wish to use the Mouse/Trackpad, there's an easy way to locate the man page(s) for a command.

Invoke the search under Terminal's Help menu by using the keyboard shortcut Command + Shift + /, and type in the command. The search looks for the man pages corresponding to the search term and lists them under Man Pages section.

enter image description here

Select and press Enter for the desired item to view the man page in the main window.

  • 1
    That's technically even one keystroke less than using the man in the shell – Lars Beck Apr 24 at 5:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .