man 命令是 Linux 中最常用的命令,碰到任何让你疑惑的命令,都可以 man 一下来查看详情。不只是 shell 命令,C 语言库函数和系统调用等内容也可以通过 man 命令查看。

man 命令默认查看的是 shell 命令的文档,可以指定参数 2 查看系统调用,3 查看 C 库函数(需要提前安装)。可以在 Linux 中直接输入 man man 查看 man 命令的帮助文档,最常用的就是查看 shell 命令、系统调用和库函数,例如:

man printf
man 2 open
man 3 printf

man 文档:

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.

安装 man 手册

各大 Linux 发行版默认带了 shell 命令的 man 文档,其他文档需要自己下载。

安装最新版本的 man 手册

官方下载链接:https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/ 。在 man-pages-posix 文件夹下,有 POSIX 的 man 手册。

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:

apt-get install manpages

安装 C 库函数手册

首先执行下面的命令,如果报错找不到文档,则说明没有安装:

man 3 printf

Ubuntu 下需要一个个单独安装,或用通配符一次安装:

apt-get install manpages-dev
apt-get install manpages*

CentOS 则可以一次安装:

yum install man-pages

Linux 下 C 库函数的 man 手册的说明

  • manpages:Linux 的基本命令的用法,针对 Linux 用户
  • manpages-dev:Linux 及 C 标准库的 API,针对 Linux 开发者
  • manpages-posix:POSIX 标准接口
  • manpages-posix-dev:POSIX 的头文件和函数库的用法

最新文章

  1. 完美解决,浏览器下拉显示网址问题 | 完美解决,使用原生 scroll 写下拉刷新
  2. 13.代理模式(Proxy Pattern)
  3. split(),preg_split()与explode()函数分析与介
  4. 转:SELENIUM TIPS: CSS SELECTORS
  5. VisualSVN SERVER的安装和使用
  6. psql: 致命错误: 用户 "postgres" Ident 认证失败
  7. nginx之location配置
  8. 判断当前是否运行于Design Mode
  9. vc多文档应用程序窗口初始化,关闭子框架,标题,动态切换
  10. QT 内存泄露 检测
  11. 花非花-记一次linux上运行时报找不到库函数错误
  12. 启动Tomcat自动加载(运行)类
  13. hdu_1907:John(Nim变形)
  14. End up with More Teams UVA - 11088
  15. 移动端头部固定,上划逐渐透明 (vue)
  16. mysql5.7 修改root密码无法登陆原因
  17. 网络编程 -- RPC实现原理 -- RPC -- 迭代版本V4 -- 远程方法调用 整合 Spring 自动注册
  18. Amazon SES SPF和DKIM设置教程
  19. BZOJ2339 HNOI2011卡农(动态规划+组合数学)
  20. C语言 · 简单加法

热门文章

  1. Linux学习之CentOS(二十六)--Linux磁盘管理:LVM逻辑卷的创建及使用
  2. horizon服务
  3. shell之文本过滤(awk)
  4. docker安装各类软件
  5. JAVA笔记15-线程同步
  6. API网关原理
  7. .NET DotnetSpider--WebDrvierSpider(ajax动态加载的数据获取)
  8. Cassandra 数据一致性
  9. JavaScript动态创建script标签并执行js代码
  10. 计算器work_day05