Fork me on GitHub

Linux-帮助的用法

Linux帮助使用方法

内部命令:help COMMAND 或 man bash
外部命令:

(1) COMMAND --help
   COMMAND -h

--help和-h选项
显示用法总结和参数列表
示例:
date --help

 1 [root@localhost ~]# date --help
 2 用法:date [选项]... [+格式]
 3  或:date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
 4 Display the current time in the given FORMAT, or set the system date.
 5 
 6 Mandatory arguments to long options are mandatory for short options too.
 7   -d, --date=STRING         display time described by STRING, not 'now'
 8   -f, --file=DATEFILE       like --date once for each line of DATEFILE
 9   -I[TIMESPEC], --iso-8601[=TIMESPEC]  output date/time in ISO 8601 format.
10                             TIMESPEC='date' for date only (the default),
11                             'hours', 'minutes', 'seconds', or 'ns' for date
12                             and time to the indicated precision.
13   -r, --reference=文件        显示文件指定文件的最后修改时间
14   -R, --rfc-2822        以RFC 2822格式输出日期和时间
15                 例如:2006年8月7日,星期一 12:34:56 -0600
16       --rfc-3339=TIMESPEC   output date and time in RFC 3339 format.
17                             TIMESPEC='date', 'seconds', or 'ns' for
18                             date and time to the indicated precision.
19                             Date and time components are separated by
20                             a single space: 2006-08-07 12:34:56-06:00
21   -s, --set=STRING          set time described by STRING
22   -u, --utc, --universal    print or set Coordinated Universal Time (UTC)
23       --help        显示此帮助信息并退出
24       --version        显示版本信息并退出
25 
26 给定的格式FORMAT 控制着输出,解释序列如下:
27 
28   %%    一个文字的 %
29   %a    当前locale 的星期名缩写(例如: 日,代表星期日)
30   %A    当前locale 的星期名全称 (如:星期日)
31   %b    当前locale 的月名缩写 (如:一,代表一月)
32   %B    当前locale 的月名全称 (如:一月)
33   %c    当前locale 的日期和时间 (如:2005年3月3日 星期四 23:05:25)
34   %C    世纪;比如 %Y,通常为省略当前年份的后两位数字(例如:20)
35   %d    按月计的日期(例如:01)
36   %D    按月计的日期;等于%m/%d/%y
37   %e    按月计的日期,添加空格,等于%_d
38   %F    完整日期格式,等价于 %Y-%m-%d
39   %g    ISO-8601 格式年份的最后两位 (参见%G)
40   %G    ISO-8601 格式年份 (参见%V),一般只和 %V 结合使用
41   %h    等于%b
42   %H    小时(00-23)
43   %I    小时(00-12)
44   %j    按年计的日期(001-366)
45   %k   hour, space padded ( 0..23); same as %_H
46   %l   hour, space padded ( 1..12); same as %_I
47   %m   month (01..12)
48   %M   minute (00..59)
49   %n    换行
50   %N    纳秒(000000000-999999999)
51   %p    当前locale 下的"上午"或者"下午",未知时输出为空
52   %P    与%p 类似,但是输出小写字母
53   %r    当前locale 下的 12 小时时钟时间 (如:11:11:04 下午)
54   %R    24 小时时间的时和分,等价于 %H:%M
55   %s    自UTC 时间 1970-01-01 00:00:00 以来所经过的秒数
56   %S    秒(00-60)
57   %t    输出制表符 Tab
58   %T    时间,等于%H:%M:%S
59   %u    星期,1 代表星期一
60   %U    一年中的第几周,以周日为每星期第一天(00-53)
61   %V    ISO-8601 格式规范下的一年中第几周,以周一为每星期第一天(01-53)
62   %w    一星期中的第几日(0-6),0 代表周一
63   %W    一年中的第几周,以周一为每星期第一天(00-53)
64   %x    当前locale 下的日期描述 (如:12/31/99)
65   %X    当前locale 下的时间描述 (如:23:13:48)
66   %y    年份最后两位数位 (00-99)
67   %Y    年份
68   %z +hhmm        数字时区(例如,-0400)
69   %:z +hh:mm        数字时区(例如,-04:00)
70   %::z +hh:mm:ss    数字时区(例如,-04:00:00)
71   %:::z            数字时区带有必要的精度 (例如,-04,+05:30)
72   %Z            按字母表排序的时区缩写 (例如,EDT)
73 
74 默认情况下,日期的数字区域以0 填充。
75 The following optional flags may follow '%':
76 
77   -  (hyphen) do not pad the field
78   _  (underscore) pad with spaces
79   0  (zero) pad with zeros
80   ^  use upper case if possible
81   #  use opposite case if possible
82 
83 在任何标记之后还允许一个可选的域宽度指定,它是一个十进制数字。
84 作为一个可选的修饰声明,它可以是E,在可能的情况下使用本地环境关联的
85 表示方式;或者是O,在可能的情况下使用本地环境关联的数字符号。
86 
87 Examples:
88 Convert seconds since the epoch (1970-01-01 UTC) to a date
89   $ date --date='@2147483647'
90 
91 Show the time on the west coast of the US (use tzselect(1) to find TZ)
92   $ TZ='America/Los_Angeles' date
93 
94 Show the local time for 9AM next Friday on the west coast of the US
95   $ date --date='TZ="America/Los_Angeles" 09:00 next Fri'
96 
97 GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
98 请向<http://translationproject.org/team/zh_CN.html> 报告date 的翻译错误
99 要获取完整文档,请运行:info coreutils 'date invocation'
View Code

 

[] 表示可选项

CAPS或 <> 表示变化的数据
... 表示一个列表
x |y| z 的意思是“ x 或 y 或 z “
-abc的 意思是-a -b –c
{ } 表示分组

 (2) 使用手册(manual)

man COMMAND

示例 man date

  1 [root@localhost ~]# man date
  2 DATE(1)                                                    FSF                                                    DATE(1)
  3 
  4 NAME
  5        date - 打印或设置系统日期和时间
  6 
  7 总览
  8        date [选项]... [+格式]
  9        date [选项] [MMDDhhmm[[CC]YY][.ss]]
 10 
 11 描述
 12        根据指定格式显示当前时间或设置系统时间.
 13 
 14        -d, --date=STRING
 15               显示由 STRING 指定的时间, 而不是当前时间
 16 
 17        -f, --file=DATEFILE
 18               显示 DATEFILE 中每一行指定的时间, 如同将 DATEFILE 中的每行作为 --date 的参数一样
 19 
 20               -I, --iso-8601[=TIMESPEC] 按照 ISO-8601 的日期/时间格式输出时间.
 21 
 22               TIMESPEC=`date' (或者不指定时)仅输出日期,等于 `hours', `minutes', 或`seconds' 时按照指定精度输出日期及时间.
 23 
 24        -r, --reference=FILE
 25               显示 FILE 的最后修改时间
 26 
 27        -R, --rfc-822
 28               根据 RFC-822 指定格式输出日期
 29 
 30        -s, --set=STRING
 31               根据 STRING 设置时间
 32 
 33        -u, --utc, --universal
 34               显示或设置全球时间(格林威治时间)
 35 
 36        --help 显示本帮助文件并退出
 37 
 38        --version
 39               显示版本信息并退出
 40 
 41        格式 FORMAT 控制着输出格式. 仅当选项指定为全球时间时本格式才有效。 分别解释如下:
 42 
 43        %%     文本的 %
 44 
 45        %a     当前区域的星期几的简写 (Sun..Sat)
 46 
 47        %A     当前区域的星期几的全称 (不同长度) (Sunday..Saturday)
 48 
 49        %b     当前区域的月份的简写 (Jan..Dec)
 50 
 51        %B     当前区域的月份的全称(变长) (January..December)
 52 
 53        %c     当前区域的日期和时间 (Sat Nov 04 12:02:33 EST 1989)
 54 
 55        %d     (月份中的)几号(用两位表示) (01..31)
 56 
 57        %D     日期(按照 月/日期/年 格式显示) (mm/dd/yy)
 58 
 59        %e     (月份中的)几号(去零表示) ( 1..31)
 60 
 61        %h     同 %b
 62 
 63        %H     小时(按 24 小时制显示,用两位表示) (00..23)
 64 
 65        %I     小时(按 12 小时制显示,用两位表示) (01..12)
 66 
 67        %j     (一年中的)第几天(用三位表示) (001..366)
 68 
 69        %k     小时(按 24 小时制显示,去零显示) ( 0..23)
 70 
 71        %l     小时(按 12 小时制显示,去零表示) ( 1..12)
 72 
 73        %m     月份(用两位表示) (01..12)
 74 
 75        %M     分钟数(用两位表示) (00..59)
 76 
 77        %n     换行
 78 
 79        %p     当前时间是上午 AM 还是下午 PM
 80 
 81        %r     时间,按 12 小时制显示 (hh:mm:ss [A/P]M)
 82 
 83        %s     从 1970年1月1日0点0分0秒到现在历经的秒数 (GNU扩充)
 84 
 85        %S     秒数(用两位表示)(00..60)
 86 
 87        %t     水平方向的 tab 制表符
 88 
 89        %T     时间,按 24 小时制显示(hh:mm:ss)
 90 
 91        %U     (一年中的)第几个星期,以星期天作为一周的开始(用两位表示) (00..53)
 92 
 93        %V     (一年中的)第几个星期,以星期一作为一周的开始(用两位表示) (01..52)
 94 
 95        %w     用数字表示星期几 (0..6); 0 代表星期天
 96 
 97        %W     (一年中的)第几个星期,以星期一作为一周的开始(用两位表示) (00..53)
 98 
 99        %x     按照 (mm/dd/yy) 格式显示当前日期
100 
101        %X     按照 (%H:%M:%S) 格式显示当前时间
102 
103        %y     年的后两位数字 (00..99)
104 
105        %Y     年(用 4 位表示) (1970...)
106 
107        %z     按照 RFC-822 中指定的数字时区显示(如, -0500) (为非标准扩充)
108 
109        %Z     时区(例如, EDT (美国东部时区)), 如果不能决定是哪个时区则为空
110 
111        默认情况下,用 0 填充数据的空缺部分.  GNU 的 date 命令能分辨在 `%'和数字指示之间的以下修改.
112 
113               `-' (连接号) 不进行填充 `_' (下划线) 用空格进行填充
114 
115 BUG报告
116        请向<bug-sh-utils@gnu.org>报告BUG.
117 
118 参考
119        关于 date 的详细说明是个 Texinfo 手册. 如果在你的计算机上已经成功安装了 info 和 date 程序,你可以使用
120 
121               info date
122 
123        命令访问完全手册.
124 
125 版权
126        Copyright  ©  1999  Free  Software Foundation, Inc.  This is free software; see the source for copying conditions.
127        There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
128 
129 [中文版维护人]
130        liguoping <email>
131 
132 [中文版最新更新]
133        2001/07/15
134 
135 《中国linux论坛man手册页翻译计划》:
136        http://cmpp.linuxforum.net
137 
138 GNU sh-utils 2.0                                       August 1999                                                DATE(1)
View Code

 

man 命令操作按键,使用快捷键可以快速高效的阅读帮助文档。

按键 作用
空格键 向下翻一页
Page Down 向下翻一页
Page Up 向上翻一页
y , k 向文件首部翻一行
e , j 向文件尾部翻一行
b 向文件首部翻屏
u 向文件首部翻半屏
d 向文件尾部翻半屏
HOME 直接前往首页
END 直接前往尾页
1G 回到文件首部
G 翻至文件尾部
跳转至第#行
/关键词 从上至下搜索某个关键词
?关键词 从下至上搜索某个关键词
n 定位到下一个搜索到的关键词
N 定位到上一个搜索到的关键词
q 退出帮助文档


   

 

 

 

 

 

 

 

 

 

  

 

 

 

 

 

 

 

 

 

 

 

 

(3) 信息页 info COMMAND

示例 info date

 1 [root@localhost ~]# info date
 2 
 3 File: coreutils.info,  Node: date invocation,  Next: arch invocation,  Up: System context
 4 
 5 21.1 'date': Print or set system date and time
 6 ==============================================
 7 
 8 Synopses:
 9 
10      date [OPTION]... [+FORMAT]
11      date [-u|--utc|--universal] [ MMDDhhmm[[CC]YY][.ss] ]
12 
13    Invoking 'date' with no FORMAT argument is equivalent to invoking it
14 with a default format that depends on the 'LC_TIME' locale category.  In
15 the default C locale, this format is ''+%a %b %e %H:%M:%S %Z %Y'', so
16 the output looks like 'Thu Mar  3 13:47:51 PST 2005'.
17 
18    Normally, 'date' uses the time zone rules indicated by the 'TZ'
19 environment variable, or the system default rules if 'TZ' is not set.
20 *Note Specifying the Time Zone with 'TZ': (libc)TZ Variable.
21 
22    If given an argument that starts with a '+', 'date' prints the
23 current date and time (or the date and time specified by the '--date'
24 option, see below) in the format defined by that argument, which is
25 similar to that of the 'strftime' function.  Except for conversion
26 specifiers, which start with '%', characters in the format string are
27 printed unchanged.  The conversion specifiers are described below.
28 
29    An exit status of zero indicates success, and a nonzero value
30 indicates failure.
31 
32 * Menu:
33 
34 * Time conversion specifiers::     %[HIklMNpPrRsSTXzZ]
35 * Date conversion specifiers::     %[aAbBcCdDeFgGhjmuUVwWxyY]
36 * Literal conversion specifiers::  %[%nt]
37 * Padding and other flags::        Pad with zeros, spaces, etc.
38 * Setting the time::               Changing the system clock.
39 * Options for date::               Instead of the current time.
40 * Date input formats::             Specifying date strings.
41 * Examples of date::               Examples.
View Code

info 命令操作按键;

按键 作用
空格键 向下翻一页
Page Down 向下翻一页
Page Up 向上翻一页
tab 在节点之间移动,有节点的地方,通常会以*显示
Enter 当光标在节点上面时,按下Enter可以进入该节点
b 移动光标到该节点画面当中的第一个节点处
e 移动光标到该节点画面当中的最后一个节点处
n 前往下一个信息页面
p 前往上一个信息页面
u 向上移动一层
s(/) 在信息页面当中进行搜索
h 显示帮助菜单
? 指令列表
q 退出

 

     

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(4) 程序自身的帮助文档

README
INSTALL
ChangeLog
(5) 程序官方文档
官方站点:Documentation
(6) 发行版的官方文档
(7) Google

 

posted @ 2019-03-19 19:39  苦逼运维-匿名  阅读(761)  评论(2编辑  收藏  举报
1 2 3 4