man 获得帮助信息

一、使用man工具

1.man机制概述

Linux提供的一种集中手册页文档机制

−大多数程序/配置文件/库函数都提供手册页

−包括命令名称、语法、用途描述、选项、作者等信息

−通过统一阅读工具man来获得这些帮助

2.使用man帮助工具

 3.练习

查阅uname命令的man手册页,解释其格式及常见选项

[root@hadoop ~]# man uname

UNAME(1)                         User Commands                        UNAME(1)

NAME
       uname - print system information

SYNOPSIS
       uname [OPTION]...

DESCRIPTION
       Print certain system information.  With no OPTION, same as -s.

       -a, --all
              print all information, in the following order, except omit -p and -i if unknown:

       -s, --kernel-name
              print the kernel name

       -n, --nodename
              print the network node hostname

       -r, --kernel-release
              print the kernel release

       -v, --kernel-version
              print the kernel version

       -m, --machine
              print the machine hardware name

       -p, --processor
              print the processor type or "unknown"

       -i, --hardware-platform
              print the hardware platform or "unknown"

       -o, --operating-system
              print the operating system

       --help display this help and exit

       --version
              output version information and exit

AUTHOR
       Written by David MacKenzie.

REPORTING BUGS
       Report uname bugs to bug-coreutils@gnu.org
       GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
       General help using GNU software: <http://www.gnu.org/gethelp/>
       Report uname translation bugs to <http://translationproject.org/team/>

COPYRIGHT
       Copyright  ©  2010  Free  Software  Foundation,  Inc.   License  GPLv3+:  GNU  GPL version 3 or later
       <http://gnu.org/licenses/gpl.html>.
       This is free software: you are free to change and redistribute it.  There  is  NO  WARRANTY,  to  the
       extent permitted by law.

SEE ALSO
       arch(1), uname(2)

       The  full  documentation for uname is maintained as a Texinfo manual.  If the info and uname programs
       are properly installed at your site, the command

              info coreutils 'uname invocation'

       should give you access to the complete manual.

GNU coreutils 8.4                November 2013                        UNAME(1)

查阅shutdown命令的man手册页,解释其格式及常见选项

[root@hadoop ~]# man shutdown

shutdown(8)                                                        shutdown(8)

NAME
       shutdown - bring the system down

SYNOPSIS
       shutdown [OPTION]...  TIME [MESSAGE]

DESCRIPTION
       shutdown  arranges for the system to be brought down in a safe way.  All logged-in users are notified
       that the system is going down and, within the last five minutes of TIME, new logins are prevented.

       TIME may have different formats, the most common is simply the word ’now’ which will bring the system
       down  immediately.   Other valid formats are +m, where m is the number of minutes to wait until shut-
       ting down and hh:mm which specifies the time on the 24hr clock.

       Once TIME has elapsed, shutdown sends a request to the init(8) daemon to bring the system  down  into
       the appropriate runlevel.

       This  is performed by emitting the runlevel(7) event, which includes the new runlevel in the RUNLEVEL
       environment variable as well as  the  previous  runlevel  (obtained  from  the  environment  or  from
       /var/run/utmp)  in  the  PREVLEVEL  variable.  An additional INIT_HALT variable may be set, this will
       contain the value HALT when bringing the system down for halt and POWEROFF when bringing  the  system
       down for power off.

OPTIONS
       -r     Requests that the system be rebooted after it has been brought down.

       -h     Requests  that the system be either halted or powered off after it has been brought down, with
              the choice as to which left up to the system.

       -H     Requests that the system be halted after it has been brought down.

       -P     Requests that the system be powered off after it has been brought down.

       -c     Cancels a running shutdown.  TIME is not specified with this option,  the  first  argument  is
              MESSAGE.

       -k     Only  send out the warning messages and disable logins, do not actually bring the system down.

ENVIRONMENT
       RUNLEVEL
              shutdown will read the current runlevel from this environment variable if set in preference to
              reading from /var/run/utmp

FILES
       /var/run/utmp
              Where the current runlevel will be read from; this file will also be updated with the new run-
              level.

       /var/log/wtmp
              A new runlevel record will be appended to this file for the new runlevel.

NOTES
       The Upstart init(8) daemon does not keep track of runlevels  itself,  instead  they  are  implemented
       entirely by its userspace tools.

       See runlevel(7) for more details.

AUTHOR
       Written by Scott James Remnant <scott@netsplit.com>

REPORTING BUGS
       Report bugs at <https://launchpad.net/upstart/+bugs>

COPYRIGHT
       Copyright © 2009 Canonical Ltd.
       This  is  free  software;  see the source for copying conditions.  There is NO warranty; not even for
       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

SEE ALSO
       runlevel(7) init(8) telinit(8) reboot(8)

Upstart                           2009-07-09                       shutdown(8)

二、man手册页的分节

1.man手册存放位置

标准manual手册文档集中存放

−/usr/share/share/man/.. .. 目录

−/usr/share/share/man/zh_CN/.. ..

[root@hadoop ~]# manpath
/usr/local/share/man:/usr/share/man/en:/usr/share/man:/usr/soft/jdk/man:/usr/soft/scala/man

2.分节机制及入口

man分节入口

1用户指令、2 系统、3 程序库、4 设备、5文件系统、6 游戏、7 杂项、8 系统指令、9 内核指令

1和8的区别在于权限,1是普通用户,8是管理员

选择指定的入口:man 节号手册名称

[root@hadoop ~]# man ls
LS(1)                            User Commands                           LS(1)
#普通用户
[root@hadoop ~]# man shutdown
shutdown(8)                                                        shutdown(8)
#管理员

3.练习

 查阅命令程序passwd的手册页信息

[root@hadoop ~]# man passwd

查阅配置文件/etc/passwd的手册页信息

[root@hadoop ~]# man 5 passwd

三、whatis手册索引

1.创建whatis数据库

使用makewhatis工具

 [root@hadoop ~]# makewhatis//耐心等待执行完毕

2.查询手册列表

使用whatis工具

用法:whatis手册名称

[root@hadoop ~]# whatis passwd
passwd               (1)  - update user's authentication tokens
passwd [sslpasswd]   (1ssl)  - compute password hashes

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

lambda-小张

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值