例如查
wait
這個命令,
[root@jcwkyl
/]# man
-k wait
部分輸出如下:
wait
(1p)
- await process completion
wait
(2)
- wait for process to change state
wait
(3p)
- wait for a child process to stop or terminate
wait3 [wait4]
(2)
-
wait for process to change state, BSD style
wait4
(2)
-
wait for process to change state, BSD style
wait
[builtins
]
(1)
- bash built-in commands, see bash(1)
waitid
(3p)
- wait for a child process to change state
waitpid
[wait]
(2)
- wait for process to change state
waitpid
[wait]
(3p)
- wait for a child process to stop or terminate
上述命令
man –k
等同於
apropos
命令。會看到輸出的第行分三部分,最中間的部分就表示這個命令在哪一類。例如:
wait
(2)
- wait for process to change state
就表示這個一個系統調用。因為分類
2
是系統調用的分類。
man
文檔分為
9
大類
(
來自
http://tldp.org/HOWTO/Man-Page/q2.html
)
:
Section The human readable name
1 User commands that may be started by everyone.
2 System calls, that is, functions provided by the kernel.
3 Subroutines, that is, library functions.
4 Devices, that is, special files in the /dev directory.
5 File format descriptions, e.g. /etc/passwd .
6 Games, self-explanatory.
7 Miscellaneous, e.g. macro packages, conventions.
8 System administration tools that only root can execute.
9 Another (Linux specific) place for kernel routine documentation.
n (Deprecated) New documentation, that may be moved to a more appropriate section.
o (Deprecated) Old documentation, that may be kept for a grace period.
l (Deprecated) Local documentation referring to this particular system.
|
瞭解這些,在看一個命令的
man
文檔的
see also
部分時就能猜到這個命令大概是哪一類的,是一個
bash
命令,還是一個系統調用,還是其它,等等,心裡會有個數。
http://man.linuxmanpages.com/
這是
man
的線上文檔,它將
man
文檔分為
8
個大類,並且可以方便地點擊分類的連結來查看這個分類下面有哪些命令。
曾經自己在
linux
下寫一個
socket
程式,因為記不太清楚
sockaddr_in
資料結構的定義,但是又
man
不到,最後在
linuxforum
論壇上找到了答案:應該用
man 7 ip
來看。