[Linux command] man command

man command to view the system help manual (manual)

Basic usage:

$ man ls

LS(1)                                               User Commands                                               LS(1)

NAME
       ls - list directory contents

SYNOPSIS
       ls [OPTION]... [FILE]...

DESCRIPTION
       List  information  about the FILEs (the current directory by default).  

Operation instructions:
After executing the man command, enter the man operation interface, and display the help content of the query command.
Operation method in this interface:
1) q key to exit the man command.
2) Arrow keys, page-up, page-down to turn pages up and down.
3) '/' to enter the search mode, input keywords or regular expressions.

search by keyword

List help related to the keyword "printf".
The number in parentheses of each item is the man chapter (section) number.

$ man -k printf
asprintf (3)         - print to allocated string
caca_conio_cprintf (3caca) - The libcaca public header.
caca_conio_printf (3caca) - The libcaca public header.
caca_printf (3caca)  - (unknown subject)
caca_vprintf (3caca) - (unknown subject)
dprintf (3)          - formatted output conversion
fprintf (3)          - formatted output conversion
fwprintf (3)         - formatted wide-character output conversion
printf (1)           - format and print data
printf (3)           - formatted output conversion
snprintf (3)         - formatted output conversion
sprintf (3)          - formatted output conversion
swprintf (3)         - formatted wide-character output conversion
vasprintf (3)        - print to allocated string
vdprintf (3)         - formatted output conversion
vfprintf (3)         - formatted output conversion
vfwprintf (3)        - formatted wide-character output conversion
vprintf (3)          - formatted output conversion
vsnprintf (3)        - formatted output conversion
vsprintf (3)         - formatted output conversion
vswprintf (3)        - formatted wide-character output conversion
vwprintf (3)         - formatted wide-character output conversion
wprintf (3)          - formatted wide-character output conversion

man section

Category description

Help content is divided into several categories, namely section. The classification is as follows:

shell 命令                      1   Executable programs or shell commands
Linux系统接口函数        2   System calls (functions provided by the kernel)
C语言库函数                 3   Library calls (functions within program libraries)
特殊文件                       4   Special files (usually found in /dev)
文件格式说明                5   File formats and conventions eg /etc/passwd
(没用过)                    6   Games
杂项                               7   Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7)
系统管理相关命令         8   System administration commands (usually only for root)
(没用过)                    9   Kernel routines [Non standard]

In most cases, there is no need to specify a section, provided there is no repetition. For example, in the above example, you can directly refer to the ls help.
When there is duplicate content in different categories, you need to specify section. For example, the keyword 'printf' is queried above, and two help items with the same name can be seen in the result. The first is the printf in the shell command, and the second is the printf of the system interface (C library).

printf (1)           - format and print data
printf (3)           - formatted output conversion

do not specify section

If no section is specified, the command corresponding to the smallest section number will be displayed by default.
If you only enter 'man printf', the printf command in the shell will be displayed (section number is smaller):

$ man printf

PRINTF(1)                                           User Commands                                           PRINTF(1)

NAME
       printf - format and print data

SYNOPSIS
       printf FORMAT [ARGUMENT]...
       printf OPTION

Specified section

By specifying a section, you can view a specific manual page:
the following 2 methods have the same effect, and they are all specified in section 3, and query printf.

$ man printf.3
$ man 3 printf
PRINTF(3)                                     Linux Programmer's Manual                                     PRINTF(3)

NAME
       printf, fprintf, dprintf, sprintf, snprintf, vprintf, vfprintf, vdprintf, vsprintf, vsnprintf - formatted out‐
       put conversion

These are some of the more commonly used functions. For more detailed functions, please refer to:

$ man man

Guess you like

Origin blog.csdn.net/yinminsumeng/article/details/129547172