Jump to content

Guide to Unix/Commands/Getting Help

From Wikibooks, open books for an open world

Displays the manual page for the specified command

A useful option is:

$ man -k TEXT  

This searches manual page titles and synopsis lines for TEXT

Examples:

To display the manual page for the chown command:

$ man chown

man has different sections.

  • section 1 is user commands
  • section 2 is system calls (used by programs to communicate with the kernel)
  • section 3 is library reference (for programming in C)
  • section 4 is device drivers
  • section 5 is configuration files and other file formats
  • section 6 is games
  • section 7 is miscellaneous (for example, "ascii" map and C "operator" precedence)
  • section 8 is system commands (like user commands, but mostly for root)

A section number can be specified before the page name. For example, man chmod normally shows the user command "chmod". To see the system call "chmod":

$ man 2 chmod

To search the man pages for "newsgroups",

$ man -k newsgroups
actsync              (8)  - synchronize newsgroupsoups
newsgroups           (1)  - a program to list unsubscribed newsgroups
  • If this does not work you may have to run the makewhatis command.

Links:

An advanced man command that is sometimes available. It displays the improved manual pages in Info format for specified command. Seems absent from POSIX.

Examples:

To display the manual page for the grep command:

$ info grep

To find occurrence of 'grep' in all info manual pages:

$ info --apropos grep
"(autoconf-2.13)Examining Declarations" -- EGREP_CPP
"(autoconf-2.13)Examining Declarations" -- EGREP_HEADER
"(autoconf-2.13)Old Macro Names" -- HEADER_EGREP
...

To see the physical location of 'grep' info manual page:

$ info -w grep
/usr/share/info/grep.info.gz

To view a file a info page:

$ info -f ./some_cmd.info.gz

Links:

apropos

[edit | edit source]

Searches the manual page short descriptions for a specified keyword. Seems absent from POSIX.

On many systems this is exactly the same as the -k option of the man command.

Examples:

$ apropos newsgroups
active               (5)  - list of active Usenet newsgroups
newsgroups           (1)  - a program to list unsubscribed newsgroups

Links:

whatis

[edit | edit source]

Displays short man page descriptions. Seems absent from POSIX.

Examples:

$ whatis info
info (1)             - read Info documents
info (5)             - readable online documentation
$ whatis chmod
chmod (1) - change file modes
chmod, fchmod (2) - change mode of file

Links:

makewhatis

[edit | edit source]

Creates the database for the whatis, apropos, and man -k commands. This is commonly run automatically by your system however sometimes you need to run this manually. Seems absent from POSIX.

Examples:

# makewhatis
$ sudo makewhatis

Links: