我使用过的Linux命令之man - 显示在线手册页

我使用过的Linux命令之man - 显示在线手册页

本文链接:http://codingstandards.iteye.com/blog/971078   (转载请注明出处)

用途说明

man命令是个常用的命令,如果你稍微熟悉Unix/Linux系统的话,它用来显示在线手册页,是获取命令、函数、配置文件等的帮助信息的重要手段,另外一个手段是info命令。manpage就是手册页,它有一定的编写格式,Linux系统在文档方面是做得相当不错的,这给我们使用Linux提供了方便。shell内置命令的手册页,显示的是bash全部内置命令的手册页,可以采用help命令来获取内置命令的帮助信息。

 

常用参数

格式:man <cmd>

显示<cmd>命令的手册页。默认情况下,man命令使用less作为显示文档的命令。

 

手册页的操作指令:

按q退出,这个最重要,因为Ctrl+C都没法退出来

按下箭头可以往后一行

按回车或者上箭头可以往前一行

按End键可以翻到最后一页

按Home键可以翻到第一页

按空白键或者PgDn键可以往后翻一页

按PgUp键可以往前翻一页

输入/keyword回车可以搜索keyword

输入?keyword回车可以往前搜索keyword

按n可以往前或往后搜索下一个

 

格式:man -k <cmd>

格式:apropos <cmd>

显示与<cmd>有关的手册页列表。

 

格式:man 1 <cmd>

显示<cmd>命令的手册页。

 

格式:man 2 <syscall>

显示系统调用<syscall>的手册页。

 

格式:man <section> <name>

显示<name>指定章节<section>的手册页,其中<section>包括

1、Standard commands (标准命令)
2、System calls (系统调用)
3、Library functions (库函数)
4、Special devices (设备说明)
5、File formats (文件格式)
6、Games and toys (游戏和娱乐)
7、Miscellaneous (杂项)
8、Administrative Commands (管理员命令)

 

使用示例

示例一 显示man的手册页

[root@jfht ~]# man man
man(1)                                                                  man(1)

NAME
       man - format and display the on-line manual pages

SYNOPSIS
       man  [-acdfFhkKtwW] [--path] [-m system] [-p string] [-C config_file] [-M pathlist] [-P pager] [-B browser] [-H
       htmlpager] [-S section_list] [section] name ...

DESCRIPTION
       man formats and displays the on-line manual pages.  If you specify section, man only looks in that  section  of
       the  manual.  name is normally the name of the manual page, which is typically the name of a command, function,
       or file.  However, if name contains a slash (/) then man interprets it as a file specification, so that you can
       do man ./foo.5 or even man /cd/foo/bar.1.gz.

       See below for a description of where man looks for the manual page files.

OPTIONS
       -C  config_file
              Specify the configuration file to use; the default is /etc/man.config.  (See man.config(5).)

       -M  path
              Specify  the  list  of  directories  to search for man pages.  Separate the directories with colons.  An
              empty list is the same as not specifying -M at all.  See SEARCH PATH FOR MANUAL PAGES.

       -P  pager
              Specify which pager to use.  This option overrides the MANPAGER  environment  variable,  which  in  turn
              overrides the PAGER variable.  By default, man uses /usr/bin/less -is.

       -B     Specify  which browser to use on HTML files.  This option overrides the BROWSER environment variable. By
              default, man uses /usr/bin/less-is,

       -H     Specify a command that renders HTML files as text.  This  option  overrides  the  HTMLPAGER  environment
              variable. By default, man uses /bin/cat,

       -S  section_list
              List is a colon separated list of manual sections to search.  This option overrides the MANSECT environ-
              ment variable.

       -a     By default, man will exit after displaying the first manual page it finds.  Using this option forces man

:q
[root@jfht ~]#

 

示例二 显示C函数printf的手册页

[root@jfht ~]# man printf
PRINTF(1)                        User Commands                       PRINTF(1)

NAME
       printf - format and print data

SYNOPSIS
       printf FORMAT [ARGUMENT]...
       printf OPTION

DESCRIPTION
       Print ARGUMENT(s) according to FORMAT.

       --help display this help and exit

       --version
              output version information and exit

       FORMAT controls the output as in C printf.  Interpreted sequences are:

       \"     double quote

       \NNN   character with octal value NNN (1 to 3 digits)

       \\     backslash

       \a     alert (BEL)

       \b     backspace

       \c     produce no further output

       \f     form feed

       \n     new line

       \r     carriage return

       \t     horizontal tab

       \v     vertical tab

:q

注:上面显示的是命令printf的手册页,但不是C函数printf的手册页。
[root@jfht ~]# man 3 printf
PRINTF(3)                  Linux Programmer’s Manual                 PRINTF(3)

NAME
       printf, fprintf, sprintf, snprintf, vprintf, vfprintf, vsprintf, vsnprintf - formatted output conversion

SYNOPSIS
       #include <stdio.h>

       int printf(const char *format, ...);
       int fprintf(FILE *stream, const char *format, ...);
       int sprintf(char *str, const char *format, ...);
       int snprintf(char *str, size_t size, const char *format, ...);

       #include <stdarg.h>

       int vprintf(const char *format, va_list ap);
       int vfprintf(FILE *stream, const char *format, va_list ap);
       int vsprintf(char *str, const char *format, va_list ap);
       int vsnprintf(char *str, size_t size, const char *format, va_list ap);

DESCRIPTION
       The  functions  in  the  printf() family produce output according to a format as described below. The functions
       printf() and vprintf() write output to stdout, the standard output stream; fprintf() and vfprintf() write  out-
       put to the given output stream; sprintf(), snprintf(), vsprintf() and vsnprintf() write to the character string
       str.

       The functions vprintf(),  vfprintf(),  vsprintf(),  vsnprintf()  are  equivalent  to  the  functions  printf(),
       fprintf(),  sprintf(),  snprintf(), respectively, except that they are called with a va_list instead of a vari-
       able number of arguments. These functions do not call the va_end macro. Consequently, the value of ap is  unde-
       fined after the call. The application should call va_end(ap) itself afterwards.

       These eight functions write the output under the control of a format string that specifies how subsequent argu-
       ments (or arguments accessed via the variable-length argument facilities of stdarg(3)) are converted  for  out-
       put.

   Return value
       Upon  successful  return,  these  functions return the number of characters printed (not including the trailing
       ’\0’ used to end output to strings).  The functions snprintf() and vsnprintf() do  not  write  more  than  size
       bytes  (including  the  trailing ’\0’).  If the output was truncated due to this limit then the return value is
       the number of characters (not including the trailing ’\0’) which would have been written to the final string if
[root@jfht ~]#

 

示例三 查找与kill有关的手册页

[root@jfht ~]# man -k kill
kill                 (1)  - terminate a process
kill                 (1p)  - terminate or signal processes
kill                 (2)  - send signal to a process
kill                 (3p)  - send a signal to a process or a group of processes
kill [builtins]      (1)  - bash built-in commands, see bash(1)
killall              (1)  - kill processes by name
killchar [curs_termattrs] (3x)  - curses environment query routines
killpg               (2)  - send signal to a process group
killpg               (3)  - send signal to all members of a process group
killpg               (3p)  - send a signal to a process group
killwchar [curs_termattrs] (3x)  - curses environment query routines
mysql_waitpid        (1)  - kill process and wait for its termination
mysql_zap            (1)  - kill processes that match a pattern
pkill [pgrep]        (1)  - look up or signal processes based on name and other attributes
pthread_kill         (3p)  - send a signal to a thread
skill                (1)  - send a signal or report process status
snice [skill]        (1)  - send a signal or report process status
tgkill               (2)  - Send signal sig to one specific thread, tgid
tkill                (2)  - send a signal to a single process
xkill                (1x)  - kill a client by its X resource
yes                  (1)  - output a string repeatedly until killed
[root@jfht ~]#

 

问题思考

1. manpage是由哪些部分组成的?

2. manpage的语法规则如何,以及如何变成man手册页?

 

相关资料

【1】飞诺网 linux man的使用
http://dev.firnow.com/course/6_system/linux/Linuxjs/2008109/149569.html
【2】Linux公社 Linux man章节分类以及查询
http://www.linuxidc.com/Linux/2010-12/30881.htm
【3】三二一@小鱼 (9)linux man usage
http://blog.youkuaiyun.com/livelylittlefish/archive/2009/08/26/4487971.aspx
【4】我使用过的Linux命令之apropos - 根据关键字搜索命令
http://codingstandards.iteye.com/blog/776024
【5】我使用过的Linux命令之help - 显示Bash内建命令的帮助信息
http://codingstandards.iteye.com/blog/804620
【6】我使用过的Linux命令之type - 显示命令的类型
http://codingstandards.iteye.com/blog/831504

 

返回 我使用过的Linux命令系列总目录

 

【Linux】man手册 man手册就是linux下提供给用户查看linux语法的一本书,当用户遇到一些不懂的命令/函数的时候,不用刻意地去记住命令/函数是什么,只需要记住怎么在man手册中查询即可。 阅读详情

相关推荐

Linux命令 - 使用man获取帮助信息

man是manual的缩写。是在Linux系统中存储的一部联机使用的手册,以便用户在终端上查找。我们使用Linux命令遇到困难时,可以在终端输入:man <command>,得到该command的使用帮助信息,如:man ls。这是终端就会显示出 ls 命令的手册业(manual page)。 手册业是使用less程序来看的(可以方便地使屏幕上翻和下翻),所以在man页面中可以使用less命令的所有选项。在less中比较重要的功能键有:[q]-退出,[Enter]-逐行下翻,[Space]-逐

yunfan 2677

man命令

Linux提供了丰富的帮助手册,当你需要查看某个命令的参数时不必到处上网查找,只要man一下即可。man命令是Linux下的帮助指令,通过man指令可以查看Linux中的指令帮助、配置文件帮助和编程帮助等信息。 在终端/cmd输入man man回车,查看man的使用方法 如上图,可以知道man手册的格式包含 参数 含义 NAME 命令名称及功能简要说明 SYNOPSIS 用法...

lucky多多的博客 536

man手册 中文版

Linux程序员man手册

Linux man --显示在线手册页

用途说明 man命令是个常用的命令,如果你稍微熟悉Unix/Linux系统的话,它用来显示在线手册页,是获取命令、函数、配置文件等的帮助信息的重要手段,另外一个手段是info命令。manpage就是手册页,它有一定的编写格式,Linux系统在文档方面是做得相当不错的,这给我们使用Linux提 供了方便。shell内置命令的手册页,显示的是bash全部内置命令的手册页,可以采用help命令来获取内

老莫小小朋友 3163

Linux中文man在线手册

Linux中文man在线手册 Linux中文man在线手册 Linux中文man在线手册 Linux中文man在线手册

CATIA CAA 二次开发去除面内开孔

测试模型: 代码说明:以下代码在拓扑级去除Face的内部loop,更改后的Body通过oispBody参数输出。主要使用CATSmartBodyDuplicator拓扑操作实现 HRESULT CAAStarterCmd::RemoveHoleOnFace(CATBody_var &ispBody,CATBody_var &oispBody){ CATLISTP(CATCell)olistFace; ispBody->GetAllCells(olistFace,2); CATF

weixin_45445751的博客 2264

linux man在线手册

http://www.tin.org/bin/man.cgi

u010743406的博客 1850

沐数科技数据开发岗笔试题2025

与数据库中的主键(Primary Key)​有所不同,业务主键(Business Key)​是业务层面的唯一标识,通常由业务规则决定,例如,订单号、订单明细号,身份证号等。用户授信表(table_credit):包含用户ID(uid)、授信申请时间(credit_submit_time_local)、授信状态(credit_status)。:在正态分布中,大约68%的数据值落在距离均值一个标准差的范围内,约95%的数据值落在两个标准差的范围内,而约99.7%的数据值落在三个标准差的范围内。

weixin_40121264的博客 3525

使用man在线手册页

要查看linux下的函数umask 可以使用man,例如 # man  2 umask 如果不知道man后的节号,可以使用-k先查找 # man  -k umask 如果使用-k返回太多内容,可以使用grep # man -k file | grep umask

编程的本质是数学问题 1168

【视频编码学习】AVS3参考软件HPM-4.1简单配置运行

1、用Visual Studio2017打开HPM-4.1文件夹 2、找到文件夹目录下x86_windows文件夹,因为是在win上运行该代码 3、然后找到对应vs版本(我当时2017版)的解决方案sln文件,双击打开可以看到该解决方案下的全部项目。 4、重新生成解决方案时发现提示sdk版本问题,所以右键点击所有的项目,选择重定向项目,修改一下sdk版本。 ...

谦虚勤奋诚实感恩 3100

Linux man手册

MAN(1) 手册分页显示工具 MAN(1) NAME man - 在线参考手册的接口 概述 man [-C 文件] [-d] [-D] [–warnings[=警告]] [-R 警告] [-L 区域] [-m 系统[,…]] [-M 路径] [-S 列表] [-e 扩展] [-i|-I] [–regex|–wildcard] [–names-only] [-a] [-u] [–no-subpages] [-P 分页程序] [-r 提示] [-7] [-E 编码

magiclyj的博客 623

STM32L051低功耗模式下LPUART的使用

STM32L0系列低功耗UART配置代码清单及注释,大家可参考学习使用。

嵌入式工程师 2101

Linux中man手册的安装以及使用详解

Linux中man手册的安装以及使用详解linux中man手册的安装以及使用详解man手册是什么man手册是干嘛的man手册如何安装man手册如何使用举例讲解我们来看一下man手册的目录结构。进行具体分析section分析具体结构1、NAME部分(名称)2、SYNOPSIS部分(摘要,命令语法)3、DESCRIPTION部分(描述)4、AUTHOR5、REPORTING BUGS(已报告的错误)6、COPYRIGHT(版权)7、SEE ALSO(查看相关信息的位置)man手册页的基本操作1.查找信息2.退出

qq_46140800的博客 1万+

CAN总线介绍及硬件设计

1. CAN是什么 CAN 是 Controller Area Network 的缩写(以下称为 CAN),是 ISO*1 国际标准化的串行通信协议。 在当前的汽车产业中,出于对安全性、舒适性、方便性、低公害、低成本的要求,各种各样的电子控制系统 被开发了出来。由于这些系统之间通信所用的数据类型及对可靠性的要求不尽相同,由多条总线构成的情况很 多,线束的数量也随之增加。为适应“减少线束的数量”、“......

sinat_15677011的博客 9991

Python操作WPS文档

在Python中,我们可以使用第三方库来操作WPS文档,实现自动化的文档处理。本文将介绍如何使用Python来打开、读取、修改和保存WPS文档的内容。库,我们可以打开、读取、修改和保存WPS文档的内容。你可以根据自己的需求进一步扩展和优化这些代码,实现更复杂的文档处理功能。安装完成后,我们就可以开始使用它来操作WPS文档了。方法将修改后的文档保存到指定的路径。方法将修改后的文档保存到指定的路径。在上面的代码中,我们通过修改段落的。属性,可以改变段落的文本内容。完成对文档的修改后,我们可以使用。

2301_79366177的博客 5615

Linux 下man 命令的使用

在刚刚接触到Linux的时候,我们通常需要使用man 来查阅一些命令的帮助信息。一般使用“man 命令名称”的格式就能进行简单的查询。下面关于man 的是用技巧介绍一下。 一、man 命令 使用权限 所有用户 语法格式 man [[ [-c ] [-t ] [Section] ] | [-k | -f ] ] [-F] [-m] [ -MPath ] [ -r ] [ -a ]Title

zaishaoyi的专栏 2万+

RK3568平台开发系列讲解(NPU篇)什么是RKNPU

📢本篇章将介绍RKNPU。

内核笔记 4354

Linux下 man命令的使用 及 中文man手册的安装

其内容包括命令语法、各选项的意义及相关命令。更为强大的是,不仅可以查看Linux中命令的使用帮助,还可以查看软件服务配置文件、系统调用、库函数等帮助信息。命令是Linux下最核心的命令之一。而man命令也并不是英文单词“man”的意思,它是单词manual的缩写,即。在最后一行添加“alias cman=‘man -M /usr/share/man/zh_CN’”(“"查看安装路径(默认安装路径为/usr/share/man/zh_CN):可以通过一些参数,快速查询linux帮助手册,并且格式化显示。

Bit_Dong的博客 7067

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

Linux——man手册介绍 包括中文man手册安装

1 Executable programs or shell commands 可执行程序或 shell 命令 2 System calls (functions provided by the kernel) 系统调用(内核提供的函数) 3 Library calls (functions within program libraries) 库调用(程序库中的函数) 4 Special files (usually found in /dev) ...

weixin_49356927的博客 5595

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

linux命令——man

Shell(也称为终端或壳)用户与Linux系统的交互常见执行Linux命令的格式是这样的: 命令名称 [命令参数] [命令对象]注意,命令名称、命令参数、命令对象之间请用空格键分隔。命令对象一般是指要处理的文件、目录、用户等资源,而命令参数可以用长格式(完整的选项名称),也可以用短格式(单个字母的缩写),两者分别用--与-作为前缀 令参数的长格式与短格式示例长格式 man --hel...

小菜鸟 1万+

【Linux】man手册安装使用

man手册安装,man使用,man问题解决,man参数使用,使用实例

寒雒的博客 1497

Linux | man 手册使用详解

……

u013669912的博客 2994

linux-man手册使用-ubuntu设置man帮助文档显示中文-man手册少章节

linux-man手册使用-ubuntu设置man帮助文档显示中文man命令基本介绍 man命令基本介绍CentOS设置man手册为中文man手册使用man手册参数

zhujs的博客 2192

linux命令之man及ubuntu下man

Linux man命令的使用方法(整理收集自网络) Linux提供了丰富的帮助手册,使用Linux man命令来查看一些不熟悉的命令的使用方法,还可以用来查询系统库文件中的一些函数定义和使用方法。 Linux man中的man就是manual的缩写,用来查看系统中自带的各种参考手册,但是手册页分为好几个部分,如下所示: 1Executable programs or shell com...

zh2508的博客 2034

How-to:Linux入门之阅读man手册页

Table of Contents1 什么是man手册2 从man手册中获取有用的信息3 man手册页的操作3.1 退出man3.2 查找3.3 打印1 什么是man手册首先,man是manual的简称,中文说法可以是手册。 在Linux世界中,许多新手请教某条命令的用法时, 好多不耐心的老手通常会用一条命令来回答这位无助的新手,而这条命

AndyElvis的专栏 5029
上一篇: 我使用过的Linux命令之make - 强大的编译工具
下一篇: 我使用过的Linux命令之mv - 文件或目录改名、移动位置
codingstandards
博客等级 码龄16年 12粉丝 3原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值