- 浏览: 4731915 次
- 性别:
- 来自: 上海
文章分类
最新评论
-
bzhao:
你也应该可以这样:(not tested)./rbtunnel ...
在Bash脚本中怎么关闭文件描述符? -
bzhao:
如果有A进程原代码情况下,通过如下调用,把他的子进程继承关闭则 ...
在Bash脚本中怎么关闭文件描述符? -
Master-Gao:
楼主咋没分析下源码呢?
我使用过的Linux命令之dirname - 截取给定路径的目录部分 -
jiedushi:
tail -F 就可以吧
Linux下实时跟踪log4j日志文件的bash脚本 - 增强了tail -f的功能 -
java_is_new:
新手学习了,就是不明白为一个网卡配多个ip有什么用
我使用过的Linux命令之ifconfig - 网络配置命令
我使用过的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.csdn.net/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用tar归档压缩文件时忽略某些文件和目录
2013-02-01 10:19 16922在Linux下,常用tar对文 ... -
使用nmap扫描服务器端口的一次操作
2012-11-01 17:00 15071使用nmap扫描服务器端口的一次操作 本文来自:http ... -
我使用过的Linux命令之wget - ooo
2011-09-14 13:10 0我使用过的Linux命令之wg ... -
推荐一篇学习Vim使用的好文:酷壳 - 简明 Vim 练级攻略
2011-09-09 12:53 9082简明 Vim 练级攻略 http://coolshell.c ... -
推荐一篇学习Vim使用的好文:酷壳 - 简明 Vim 练级攻略
2011-09-09 12:49 1简明 Vim 练级攻略 http://coolshell.c ... -
我使用过的Linux命令之:(冒号) - 啥也不做(除了……)
2011-08-29 13:18 11981我使用过的Linux命令之: ... -
我使用过的Linux命令之date - 显示、修改系统日期时间
2011-08-25 09:21 41904我使用过的Linux命令之da ... -
我使用过的Linux命令之declare - 声明shell变量(不知道没关系、知道了就更好的内建命令)
2011-08-16 09:22 21736我使用过的Linux命令之declare - 声明shell变 ... -
我使用过的Linux命令之alias - 设置命令的别名,让 Linux 命令更简练
2011-08-11 09:31 28711我使用过的Linux命令之alias - 设置命令的别名,让 ... -
我使用过的Linux命令之ar - 创建静态库.a文件
2011-08-08 10:40 51809我使用过的Linux命令之ar - 创建静态库.a文件 本 ... -
我使用过的Linux命令之crontab - 设置例行任务(类似于Windows中的任务计划)
2011-08-04 22:26 9687我使用过的Linux命令之crontab - 设置例行任务(类 ... -
我使用过的Linux命令之chmod - 改变文件/目录的访问权限
2011-08-03 21:33 10640我使用过的Linux命令之chmod - 改变文件/目录的访问 ... -
我使用过的Linux命令之export - 设置或显示环境变量
2011-08-02 19:55 25368我使用过的Linux命令之export - 设置或显示环境变量 ... -
我使用过的Linux命令之wc - 统计文件行数、单词数或字节数
2011-07-26 10:50 28932我使用过的Linux命令之wc - 统计文件行数、单词数或字节 ... -
我使用过的Linux命令之groupdel - 删除群组
2011-07-22 22:13 9619我使用过的Linux命令之gr ... -
我使用过的Linux命令之ifconfig - 网络配置命令
2011-07-21 20:43 60369我使用过的Linux命令之ifconfig - 网络配置命令 ... -
我使用过的Linux命令之ll - 列出文件/目录的详细信息
2011-07-20 21:22 7102我使用过的Linux命令之ll ... -
我使用过的Linux命令之mkdir - 创建目录
2011-07-20 20:58 13602我使用过的Linux命令之mkdir - 创建目录 本文链 ... -
我使用过的Linux命令之perror - 解释错误代码
2011-07-18 20:29 24966我使用过的Linux命令之perror - 解释错误代码 ... -
我使用过的Linux命令之ping - 测试与目标主机的连通性
2011-07-16 10:46 26251我使用过的Linux命令之ping - 测试与目标主机的连通性 ...
相关推荐
Linux中文man离线手册.chm
中文Linux Man 文档 ac--输出用户连接时间 access--确定文件是否可以存取访问 ali--list mail aliases apm--查询高级电源管理(APM)BIOS apropos--search the whatis database for strings at-- ...
这是一个整合了一百多个常用命令的脚本,并且增加很多命令的注释和常用的命令格式,因此可以称作自定义man手册,将其放在/bin目录下,加上执行权限,即可随便查看命令的相关注释,比如sed和awk,记录了大量命令的...
linux必备命令手册
一些linux常用命令的man手册 英文 pdf
将man-pages-3.28.tar.gz复制在Linux下的临时目录,解压后(命令为:tar -xvzf man-pages-3.28.tar.gz -C ./),之后进入解压后的目录运行:make install 即可. 验证的话随便man一个系统函数看下最后的日期即可 在我的...
Linux所有命令的中文版手册 来自CMPP <http://cmpp.linuxforum.net> 的中文手册页 目录结构的说明如下: debian:存放制作debian打包需要的所有内容 DOCS: 除了README 和README.GB, COPYING 之外的所有文档。 ...
Linux命令速查手册-_美_-Scott-Granneman
Linux 提供了丰富的帮助手册,当你需要查看某个命令的参数时不必到处上网查找, 只要 man 一下即可。 Linux 的 man 手册共有以下几个章节: 代号 代表內容 1 使用者在 shell 中可以操作的指令或可执行档 2 系統核心...
2. 为了不抵消man,我们新建cman命令作为中文查询 [root@localhost man1]# cd ~ [root@localhost ~]# echo "alias cman='man -M /usr/local/zhman/share/man/zh_CN' " >>.bash_profile [root@localhost ~]# source ...
Linux man中文参考手册,涉及到Linux API和Linux命令所有的详细介绍。
学习linux离不开学习那些命令,学习命令看man page手册是好方法。 但原版的man page是英文版的,对于像我这样英语还很菜的新手来说是不小的难题。 就找了这个中文版的man手册 安装: 1.下载中文man压缩包 ...
linux 的命令手册,是一本相当OK的手册
Linux中总共有8个手册页模块,从我们的项目开始,我们就动手尝试了将man1模块从man1模块转换为man1模块,而man1模块是Linux手册页的8个模块之一。 传统上,手册页部分的定义如下:man1-命令(程序)man2-系统调用...
Linux命令大全是指包含了Linux操作系统中所有可用命令的完整列表或手册。它通常包括了Linux系统中的核心命令、系统管理命令、文件和目录操作命令、网络命令、软件安装和配置命令等。 Linux命令大全可以作为参考手册...
Linux命令大全是指包含了Linux操作系统中所有可用命令的完整列表或手册。它通常包括了Linux系统中的核心命令、系统管理命令、文件和目录操作命令、网络命令、软件安装和配置命令等。 Linux命令大全可以作为参考手册...
该文档是Linux下的man文档做成。chm格式。共80多M。 其中,所有的“参见”部分都有链接,很方便开发者浏览相关的内容。 该chm文件支持全文搜索和标题搜索。如果你不熟悉Linux下文档的布局,可以直接 使用“搜索”->...
该文档是Linux下的man文档做成。chm格式。共80多M。 其中,所有的“参见”部分都有链接,很方便开发者浏览相关的内容。 该chm文件支持全文搜索和标题搜索。如果你不熟悉Linux下文档的布局,可以直接 使用“搜索”->...
Linuxman CHM 格式文件 Linux man 命令详细介绍 Linux学习好帮手 值得收藏的Linux命令速查手册
使用man手册页 Linux提供一种集中手册页文档机制 查看及切换目录 一级目录 通配符 alias命令