man手册相关安装,根据系统不同,命令参数不一样
CentOS系统
[root@node0 build]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
[root@node0 build]#
centos7 用yum -y install man-pages 安装支持posix函数的man手册。
[root@node0~]# man 2 open
OPEN(2) Linux Programmer's Manual OPEN(2)
NAME
open, creat - open and possibly create a file or device
SYNOPSIS
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int open(const char *pathname, int flags);
int open(const char *pathname, int flags, mode_t mode);
Ubuntu系统
我们用man查看pthread相关函数时,发现这些函数都没有。 那是因为Ubuntu没有安装全man手册。使用下面命令进行安装:sudo apt-get install manpages-de manpages-de-dev manpages-dev glibc-doc manpages-posix-dev manpages-posix
saber@ubuntu:~$ sudo apt-get install manpages-de manpages-de-dev manpages-dev glibc-doc manpages-posix-dev manpages-posix
[sudo] password for saber:
Reading package lists... Done
Building dependency tree
Reading state information... Done
manpages-dev is already the newest version (4.04-2).
manpages-de is already the newest version (1.11-1).
manpages-de-dev is already the newest version (1.11-1).
manpages-posix is already the newest version (2013a-1).
manpages-posix-dev is already the newest version (2013a-1).
glibc-doc is already the newest version (2.23-0ubuntu5).
0 upgraded, 0 newly installed, 0 to remove and 322 not upgraded.
saber@ubuntu:~$ man pthread_create
PTHREAD_CREATE(3) Linux Programmer's Manual PTHREAD_CREATE(3)
NAME
pthread_create - create a new thread
SYNOPSIS
#include <pthread.h>
int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
void *(*start_routine) (void *), void *arg);
注意:用man手册查函数的时候要输入的完整的函数名,否者帮助不出来。
saber@ubuntu:~$ man pthread
No manual entry for pthread
saber@ubuntu:~$