man 命令是 Linux 中最經常使用的命令,碰到任何讓你疑惑的命令,均可以 man 一下來查看詳情。不僅是 shell 命令,C 語言庫函數和系統調用等內容也能夠經過 man 命令查看。linux
man 命令默認查看的是 shell 命令的文檔,能夠指定參數 2 查看系統調用,3 查看 C 庫函數(須要提早安裝)。能夠在 Linux 中直接輸入 man man
查看 man 命令的幫助文檔,最經常使用的就是查看 shell 命令、系統調用和庫函數,例如:web
man printf man 2 open man 3 printf
man 文檔:shell
NAME man - an interface to the on-line reference manuals SYNOPSIS man [-C file] [-d] [-D] [--warnings[=warnings]] [-R encoding] [-L locale] [-m system[,...]] [-M path] [-S list] [-e extension] [-i|-I] [--regex|--wildcard] [--names-only] [-a] [-u] [--no-subpages] [-P pager] [-r prompt] [-7] [-E encoding] [--no-hyphenation] [--no-justification] [-p string] [-t] [-T[device]] [-H[browser]] [-X[dpi]] [-Z] [[section] page[.section] ...] ... man -k [apropos options] regexp ... man -K [-w|-W] [-S list] [-i|-I] [--regex] [section] term ... man -f [whatis options] page ... man -l [-C file] [-d] [-D] [--warnings[=warnings]] [-R encoding] [-L locale] [-P pager] [-r prompt] [-7] [-E encoding] [-p string] [-t] [-T[device]] [-H[browser]] [-X[dpi]] [-Z] file ... man -w|-W [-C file] [-d] [-D] page ... man -c [-C file] [-d] [-D] page ... man [-?V] DESCRIPTION man is the system's manual pager. Each page argument given to man is normally the name of a program, utility or function. The manual page associated with each of these arguments is then found and displayed. A section, if provided, will direct man to look only in that section of the manual. The default action is to search in all of the available sections following a pre-defined order ("1 n l 8 3 2 3posix 3pm 3perl 3am 5 4 9 6 7" by default, unless overrid‐ den by the SECTION directive in /etc/manpath.config), and to show only the first page found, even if page exists in several sections. The table below shows the section numbers of the manual followed by the types of pages they contain. 1 Executable programs or shell commands 2 System calls (functions provided by the kernel) 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] A manual page consists of several sections.
各大 Linux 發行版默認帶了 shell 命令的 man 文檔,其餘文檔須要本身下載。bash
官方下載連接:https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/ 。在 man-pages-posix 文件夾下,有 POSIX 的 man 手冊。less
wget https://www.kernel.org/pub/linux/docs/man-pages/man-pages-4.16.tar.gz tar -xvzf man-pages-4.16.tar.gz cd man-pages-4.16 make install
固然也能夠用 Linux 發行版自帶的倉庫安裝,例如 Ubuntu:ide
apt-get install manpages
首先執行下面的命令,若是報錯找不到文檔,則說明沒有安裝:svg
man 3 printf
Ubuntu 下須要一個個單獨安裝,或用通配符一次安裝:函數
apt-get install manpages-dev apt-get install manpages*
CentOS 則能夠一次安裝:spa
yum install man-pages