读书人

关于man的用法解决方法

发布时间: 2012-05-22 18:18:54 作者: rapoo

关于man的用法
man一些函数的时候应该会看到函数参数,和那些头文件,但是有些函数,我却找不到,是什么情况呢?
比如man sleep 就无法看到他的头文件,以及参数.

SLEEP(1) User Commands SLEEP(1)

NAME
sleep - delay for a specified amount of time

SYNOPSIS
sleep NUMBER[SUFFIX]...
sleep OPTION

DESCRIPTION
Pause for NUMBER seconds. SUFFIX may be ‘s’ for seconds (the default),
‘m’ for minutes, ‘h’ for hours or ‘d’ for days. Unlike most implemen-
tations that require NUMBER be an integer, here NUMBER may be an arbi-
trary floating point number.

--help display this help and exit

--version
output version information and exit

AUTHOR
Written by Jim Meyering and Paul Eggert.

REPORTING BUGS
Report bugs to <bug-coreutils@gnu.org>.

COPYRIGHT
Copyright © 2006 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the
terms of the GNU General Public License
<http://www.gnu.org/licenses/gpl.html>. There is NO WARRANTY, to the
extent permitted by law.

SEE ALSO
The full documentation for sleep is maintained as a Texinfo manual. If
the info and sleep programs are properly installed at your site, the
command

info sleep

should give you access to the complete manual.

sleep 5.97 November 2006 SLEEP(1)

这些信息不是很看的懂,也找不到自己想要,难道是linux版本问题?

[解决办法]
man 3 sleep
[解决办法]
Linux的man手册共有以下几个章节:



代 代表容
1 使用者在shell中可以操作的指令或可执行档
2 系核心可呼叫的函数与工具等
3 一些常用的函数(function)与函数库(library),大部分是C的函数库(libc)
4 装置档案的说明,通常在/dev下的档案
5 设定档或者是某些档案的格式
6 游戏(games)
7 惯例与协定等,例如Linux档案系统、网络协定、ASCII code等等的明
8 系管理可用的管理指令
9 跟kernel有关的文件

如:man 5 data


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]



1、Standard commands (标准命令)
2、System calls (系统调用)
3、Library functions (库函数)
4、Special devices (设备说明)
5、File formats (文件格式)
6、Games and toys (游戏和娱乐)
7、Miscellaneous (杂项)
8、Administrative Commands (管理员命令)
9 其他(Linux特定的), 用来存放内核例行程序的文档。

n 新文档, 可能要移到更适合的领域。
o 老文档, 可能会在一段期限内保留。
l 本地文档, 与本特定系统有关的。

例如:我们输入 man ls,它会在最左上角显示“LS(1)”,在这里,“LS”表示手册名称,而“(1)”表示该手册位于第一节章,同样,我们输入“man ifconfig”它会在最左上角显示“IFCONFIG(8)”。也可以这样输入命令:“man [章节号] 手册名称”。

man是按照手册的章节号的顺序进行搜索的,比如:
man sleep
只会显示sleep命令的手册,如果想查看库函数sleep,就要输入:
man 3 sleep


[解决办法]
楼主会man sleep查sleep的用法,何不试着man man看一下man的用法。
我常用man -f sleep看系统总共支持多少中,然后根据输出结果选择其中一种。

读书人网 >C语言

热点推荐