• man 获得帮助信息


    一、使用man工具

    1.man机制概述

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

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

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

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

    2.使用man帮助工具

     3.练习

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

    1. [root@hadoop ~]# man uname
    2. UNAME(1) User Commands UNAME(1)
    3. NAME
    4. uname - print system information
    5. SYNOPSIS
    6. uname [OPTION]...
    7. DESCRIPTION
    8. Print certain system information. With no OPTION, same as -s.
    9. -a, --all
    10. print all information, in the following order, except omit -p and -i if unknown:
    11. -s, --kernel-name
    12. print the kernel name
    13. -n, --nodename
    14. print the network node hostname
    15. -r, --kernel-release
    16. print the kernel release
    17. -v, --kernel-version
    18. print the kernel version
    19. -m, --machine
    20. print the machine hardware name
    21. -p, --processor
    22. print the processor type or "unknown"
    23. -i, --hardware-platform
    24. print the hardware platform or "unknown"
    25. -o, --operating-system
    26. print the operating system
    27. --help display this help and exit
    28. --version
    29. output version information and exit
    30. AUTHOR
    31. Written by David MacKenzie.
    32. REPORTING BUGS
    33. Report uname bugs to bug-coreutils@gnu.org
    34. GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
    35. General help using GNU software: <http://www.gnu.org/gethelp/>
    36. Report uname translation bugs to <http://translationproject.org/team/>
    37. COPYRIGHT
    38. Copyright © 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later
    39. <http://gnu.org/licenses/gpl.html>.
    40. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the
    41. extent permitted by law.
    42. SEE ALSO
    43. arch(1), uname(2)
    44. The full documentation for uname is maintained as a Texinfo manual. If the info and uname programs
    45. are properly installed at your site, the command
    46. info coreutils 'uname invocation'
    47. should give you access to the complete manual.
    48. GNU coreutils 8.4 November 2013 UNAME(1)

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

    1. [root@hadoop ~]# man shutdown
    2. shutdown(8) shutdown(8)
    3. NAME
    4. shutdown - bring the system down
    5. SYNOPSIS
    6. shutdown [OPTION]... TIME [MESSAGE]
    7. DESCRIPTION
    8. shutdown arranges for the system to be brought down in a safe way. All logged-in users are notified
    9. that the system is going down and, within the last five minutes of TIME, new logins are prevented.
    10. TIME may have different formats, the most common is simply the word ’now’ which will bring the system
    11. down immediately. Other valid formats are +m, where m is the number of minutes to wait until shut-
    12. ting down and hh:mm which specifies the time on the 24hr clock.
    13. Once TIME has elapsed, shutdown sends a request to the init(8) daemon to bring the system down into
    14. the appropriate runlevel.
    15. This is performed by emitting the runlevel(7) event, which includes the new runlevel in the RUNLEVEL
    16. environment variable as well as the previous runlevel (obtained from the environment or from
    17. /var/run/utmp) in the PREVLEVEL variable. An additional INIT_HALT variable may be set, this will
    18. contain the value HALT when bringing the system down for halt and POWEROFF when bringing the system
    19. down for power off.
    20. OPTIONS
    21. -r Requests that the system be rebooted after it has been brought down.
    22. -h Requests that the system be either halted or powered off after it has been brought down, with
    23. the choice as to which left up to the system.
    24. -H Requests that the system be halted after it has been brought down.
    25. -P Requests that the system be powered off after it has been brought down.
    26. -c Cancels a running shutdown. TIME is not specified with this option, the first argument is
    27. MESSAGE.
    28. -k Only send out the warning messages and disable logins, do not actually bring the system down.
    29. ENVIRONMENT
    30. RUNLEVEL
    31. shutdown will read the current runlevel from this environment variable if set in preference to
    32. reading from /var/run/utmp
    33. FILES
    34. /var/run/utmp
    35. Where the current runlevel will be read from; this file will also be updated with the new run-
    36. level.
    37. /var/log/wtmp
    38. A new runlevel record will be appended to this file for the new runlevel.
    39. NOTES
    40. The Upstart init(8) daemon does not keep track of runlevels itself, instead they are implemented
    41. entirely by its userspace tools.
    42. See runlevel(7) for more details.
    43. AUTHOR
    44. Written by Scott James Remnant <scott@netsplit.com>
    45. REPORTING BUGS
    46. Report bugs at <https://launchpad.net/upstart/+bugs>
    47. COPYRIGHT
    48. Copyright © 2009 Canonical Ltd.
    49. This is free software; see the source for copying conditions. There is NO warranty; not even for
    50. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    51. SEE ALSO
    52. runlevel(7) init(8) telinit(8) reboot(8)
    53. Upstart 2009-07-09 shutdown(8)

    二、man手册页的分节

    1.man手册存放位置

    标准manual手册文档集中存放

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

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

    1. [root@hadoop ~]# manpath
    2. /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 节号手册名称

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

    3.练习

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

    [root@hadoop ~]# man passwd

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

    [root@hadoop ~]# man 5 passwd
    

    三、whatis手册索引

    1.创建whatis数据库

    使用makewhatis工具

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

    2.查询手册列表

    使用whatis工具

    用法:whatis手册名称

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

  • 相关阅读:
    【C语言】【动态内存管理】malloc,free,calloc,realloc
    缓存使用的一些经验
    谷粒商城 (七) --------- SpringCloud Alibaba 基础配置
    Maven学习笔记(十三)-maven-dependency-plugin插件
    pymysql 设置返回值为字典类型
    几个非常有意思的javascript API
    分布式和集群的区别
    Solon 1.6.33 发布,更现代感的应用开发框架
    如何用神经网络预测数据,人工神经网络分析方法
    告诉你怎么让网站内容快速收录的技巧
  • 原文地址:https://blog.csdn.net/m0_55834564/article/details/126304182