日期:2014-05-16 浏览次数:20751 次
本文链接: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 (管理员命令)
?
[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 ~]#
?
[root@jfht ~]# man printf
PRINTF(1)??????????????????????? User Commands?????????????????????? PRINTF(1)
NAME
?????? prin