Introduction to man commands

Source: Internet
Author: User
Tags printable characters
Man command introduction-general Linux technology-Linux technology and application information. The following is a detailed description. Like you, maybe you only know how to use man commands to query the instruction files that come with the software or commands. In fact, there are many tips:

Linux commands

Man command

Purpose

Displays online manual entries.

Syntax

Man [[[-c] [-t] [Section] | [-k |-f] [-MPath] [-r] Title...


Description

The man command provides reference information about topics, such as commands, subroutines, and files. The man command provides a single line description of the command specified by the name. Man commands also provide information about all commands. The descriptions of these commands contain a set of user-specified keywords.

The man command is used to format the specified manual page set. If you specify a Section for the Section parameter, the man command searches for the Title specified by the Title parameter in the Section on the manual page. The value of the Section parameter can be 1 to 8 Arabic numerals or letters.

The Section letter is:
C specifies the command (including system management commands ).
F specifies the document type manual page.
L specify the library function.
N is specified as the new one.
L specified as local.
O is specified as the old one.
P is specified as public.
Note:
The n, l, o, and p fields are invalid for reading the hypertext information library. The hypertext information library contains the operating system documentation.

The number of Section is:
1 indicates the USER commands and daemon.
2 indicates system calls and kernel services.
3 indicates the child routine.
4 indicates special files, device drivers, and hardware.
5 indicates the configuration file.
6 indicates the game.
7 indicates miscellaneous commands.
8 indicates managing commands and daemon.
Note:
The operating system documentation in the Hyper Text information database consists of only three sections: the command manual page (in section 1, equivalent to section C) and the subroutine manual page (in section 3, it is equivalent to Section L) and the document manual page (in section 4, it is equivalent to section F ). When you search for Hyper Text Information, the command manual page is specified by default when segment 1, 6, 7, or 8 is specified, and the sub-routine manual page is selected by default when Segment 2 or 3 is specified, section 4 or 5 is the document manual page by default.

If the Section parameter is omitted, the man command searches all manual sections.

Man's Search Path uses a directory list separated by: (colon) with a subroutine manual. The MANPATH environment variable value is used for the default path. The MANPATH environment variable is invalid when the hypertext information library is read.

The man command display manual page is as follows:

1. Run the man command to search for the nroff directory (man?) under the/usr/share/man directory ?).
2. Run the man command to search for the formatted version directory (cat?) under the/usr/share/man directory ?). If the formatting version is available and it is modified later than the nroff command source, the man command displays the formatting version. Otherwise, the manual page is formatted and displayed with the nroff command. If the user has permission, the formatted manual page can be stored in the correct place so that the last man command is enabled without formatting the page again.
Note:
There is no nroff source on the given manual page. However, you can place the nroff source on the manual page to the man directory, and then the man command can locate and process the nroff source.
3. If the man command does not find the manual page in the/usr/share/man or/usr/share/man/cat directory, the man command will be read from the hypertext library. The hyper-text information library resides in the/usr/share/man/info directory structure and contains the operating system documentation. When reading from a Hypertext Database, the man command does not put any manual page into the/usr/share/man/cat directory structure. The man command removes the formatting information from the manual page, adjusts each exercise. They are suitable for the display, and displays the manual page using the command described in the PAGER environment variable.

When accessing the HTML database, man searches for the operating system library before finding other LPP libraries. In these databases, it processes information in the following order:
Cmds command reference
Libs subroutine, system call
Files file reference

If the standard output is a tty, the man command uses the more command with the-s and-v signs to deliver its output. The-s flag removes multiple empty rows and stops each page displayed on the screen. The-v flag prohibits non-printable characters from being displayed on the screen. To continue scrolling, Press space. After the output is stopped, continue to scroll for 11 rows and press Ctrl-D.

The PAGER environment variable can be set to any required page scheduler. The default value is the more command. To change the default page scheduler, enter:

PAGER = Somepager
Export PAGER

For example, if you customize the manual page in the opposite or partial line feed mode, you can set the PAGER environment variable to/usr/bin/pg so that the line feed will not be printed as the control character. This process is not necessary for the manual page.

When a man command uses a hypertext database, it can retrieve several objects. For example, man open displays several objects. Use SIGINT (Ctrl-C) to exit the man command completely. On the other hand, man open close also displays several objects, but using SIGINT (Ctrl-C) will display man's close command information instead of exiting. Use SIGINT (Ctrl-C) again to completely exit the man command.

When the specified "Network Computing System" routine with a name containing $ (dollar sign), enter a \ (backslash) before $ ).
Flag

-C: displays the manual information for using cat commands.
-F: only the items related to the command name given as the final parameter are displayed in the keyword database. You can enter multiple command names separated by spaces. Use this flag to search for command objects only. To use the-f flag, the root user must have previously entered catman-w to create the/usr/share/man/whatis file.
-K: each row of the string containing the title that matches the character given as the final parameter is displayed in the keyword database. You can enter multiple headers separated by spaces. To use the-k flag, the root user must have previously entered catman-w to create the/usr/share/man/whatis file.
-MPath: Change the Standard Location of man command to search manual information. The man command uses a search path that is separated by a colon (:) and contains a list of directories in the sub-directories of the manual. The MANPATH environment variable value is used as the default path.
Note:
The-M flag is invalid when the man command is read from the Hypertext Database.
-Remote search of r manual information. If the remote search fails (the reason is that the remote machine cannot be reached, a problem occurs when the URL address is read, or Java is not installed on the local machine), man requests the online help page for local search.
Note:
The DOCUMENT_SERVER_MACHINE_NAME environment variable should be set to the name of the Document Search server machine that the user wants to use. If the "AIX basic documentation" does not support the language environment of the host, the man command searches for documents in the alternate language environment. If the search is successful, the document page is displayed after being converted to the language environment of the local host. If the standby language environment is not installed on the local host, the man command fails to display the document page.
-T use the troff command to format the manual information. This flag is ignored if the manual page is found in the hypertext information base.
Exit status

This command returns the following exit value:
0.
> 0 error.
Example

1. to display information about the grep command, enter:

Man grep

2. to display information about the rpc _ $ register library routine, enter:

Man rpc _ \ $ register

3. to display all the items in the/usr/share/man/whatis keyword database that contains the "mkdir" string, enter:

Man-k mkdir

This output is equivalent to the apropos command. The output can be received from the-k flag only when the/usr/share/man/whatis keyword database already exists.
4. to display all the items in the database with keywords related to nroff and troff commands, enter:

Man-f nroff troff

This output is equivalent to the whatis command. The output can be received from the-k flag only when the/usr/share/man/whatis keyword database already exists.
5. to display all ftp-related objects in the/usr/share/man or/usr/share/man/local path, enter:

Man-M/usr/share/man:/usr/share/man/local ftp

File

/Usr/bin/man contains the man command.
/Usr/share/man standard manual directory structure.
/Usr/share/man/cat? /* Contains the directory of the pre-formatted page.
/Usr/share/man/whatis contains the keyword database.
/Usr/share/man? /* Directory containing the nroff format manual page.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.