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 的头文件和函数库的用法

Linux 命令 - man 查看命令的文档的更多相关文章

  1. 如何在命令行模式下查看Python帮助文档---dir、help、__doc__

    如何在命令行模式下查看Python帮助文档---dir.help.__doc__ 1.dir函数式可以查看对象的属性,使用方法很简单,举str类型为例,在Python命令窗口输入 dir(str) 即 ...

  2. 在命令行模式下查看Python帮助文档---dir、help、__doc__

    在命令行模式下查看Python帮助文档---dir.help.__doc__   1.dir函数式可以查看对象的属性,使用方法很简单,举str类型为例,在Python命令窗口输入 dir(str) 即 ...

  3. Linux下内存查看命令

    在Linux下面,我们常用top命令来查看系统进程,top也能显示系统内存.我们常用的Linux下查看内容的专用工具是free命令. Linux下内存查看命令free详解: 在Linux下查看内存我们 ...

  4. Linux用户登录查看命令总结 - w,who,last,lastlog

    Linux用户登录查看命令总结 - w,who,last,lastlog linux shell 747 次阅读  ·  读完需要 15 分钟 0 1. 查看登录用户信息 who -H 命令输出 NA ...

  5. 在Linux 安装Python3.5.6详细文档!!!!

    在Linux 安装Python3.5.6详细文档!!!! 1.安装相关依赖库(工具包) yum install gcc patch libffi-devel python-devel  zlib-de ...

  6. [转载]linux上用PHP读取WORD文档

    在linux上用PHP读取WORD文档,其实是使用了 antiword程序把word文档转化为txt文档. 再使用php执行系统命令调用而已. 具体操作如下: 1.安装antiword 官方站:htt ...

  7. help python(查看模块帮助文档)

    查看模块帮助文档: help(len) -- docs for the built in len function (note here you type "len" not &q ...

  8. Linux命令学习之路——变更文档拥有者:chown

    使用权限:root用户 使用方式:chown [ -cvfRh ] [ --help ] [ --version ] user[ :group ] file... 作用:该命令用于改变文档的拥有者 注 ...

  9. Linux中内容查看命令"大PK"

    众所周知linux中命令cat.more.less均可用来查看文件内容,当然还有我们"非主流"的vim以及使用较少的head.tail.tac. 下面我将介绍各种命令的用法及对比. ...

随机推荐

  1. ssh远程登录故障解决方案

    问题描述: xshell远程连接服务器连接不上,如下图所示: 故障排除: . 首先查看自己系统的防火墙是否关闭,没有关闭的话关闭一下. # centos 7中关闭防火墙命令: systemctl st ...

  2. 2018牛客网暑期ACM多校训练营(第十场)J Rikka with Nickname(二分,字符串)

    链接:https://ac.nowcoder.com/acm/contest/148/J?&headNav=acm 来源:牛客网 Rikka with Nickname 时间限制:C/C++ ...

  3. php strip_tags() 函数去除 HTML、XML 以及 PHP 的标签。

    strip_tags() 函数剥去 HTML.XML 以及 PHP 的标签.strip_tags(string,allow)参数     描述string     必需.规定要检查的字符串.allow ...

  4. 代码管理工具 Git

    之前一直使用微软的代码管理工具TFS(Team Foundation Server)..NET CORE 2.0的发布后,考虑到.NET CORE项目可以跨平台,准备把项目迁移到.NET CORE 环 ...

  5. AngularJs 简单实现全选,多选操作(转)

    代码如下: HTML: <section> <pre>{{choseArr}}</pre> 全选: <input type="checkbox&qu ...

  6. Python修炼之路-异常

    异常处理 在程序出现bug时一般不会将错误信息直接显示给用户,而是可以自定义显示内容或处理. 常见异常 AttributeError # 试图访问一个对象没有的树形,比如foo.x,但是foo没有属性 ...

  7. Docker(1)--概述

    Docker概述 Docker是一个用于开发,交付和运行应用程序的开放平台.Docker使您能够将应用程序与基础架构分开,从而可以快速交付软件.借助Docker,您可以以与管理应用程序相同的方式来管理 ...

  8. c++string int转化简单写法

    #include<iostream> #include<string> #include<sstream> //定义了stringstream类 using nam ...

  9. linux-系统启动流程-7

    1,BIOS开机自检,检查cpu硬件及开机启动顺序,查找第一个磁盘磁头的MBR信息并加载BOOtloader,然后将控制权交与bootloader 2, GRUB GRUB(Grand Unified ...

  10. webpack--第三方loader

    1.配置处理css样式表的第三方loader webpack默认只能打包处理js类型的文件,无法处理非js类型的文件:要想处理*.css文件,需要手动安装一下合适的第三方loader加载器: npm ...