探索这个“男人”

一、前言

正所谓了解一个命令就得了解他的用法,正好是要了解一个人就得了解他的兴趣爱好,处事态度以及为人是怎么样的。

二、man是什么

man – an interface to the on-line reference manuals

Manmanual(手册)的缩写,使用权限是所有用户,man命令提供为linux系统在线提供了很好的帮助手册,几乎可以说不懂就问问这个“男人”吧。

三、man都有哪些呢

 man 既然是手册,那COMMAND一定也会有会有手册,这时候就可以看man的手册如图3-1

   

图片1.png

                            图3-1man的描述

DESCRIPTION(描述)

        man 是一个系统帮助手册,每页都是不同的参数

       man is the system's manual pager. Each page argument given to man is normally

       the name of a program, utility or function.  The manual page  associated  with

       each of  these arguments is then found and displayed. A section, if provided,

       will direct man to look only in that  section  of  the  manual.   The  default

       action  is to search in all of the available sections, following a pre-defined

       order and to show only the first page found, even if page  exists  in  several

       sections.

      man是一个系统帮助手册,man有着不同章节,每个页面章节是man 的项目的名称,

     实用程序或功能,这些参数相关的手册页发现并显示,如果提供手册页的章节会把那       章节的内容输出,默认的查找是在所有可用的搜索结果,按照预定义的顺序只显示第     一个手册页,即使还有其他手册页。

 

相关的手册页有;

       1   Executable programs or shell commands

           用户命令

       2   System calls (functions provided by the kernel)

           系统调用

       3   Library calls (functions within program libraries)

           C库调用

       4   Special files (usually found in /dev)

           设备文件及特殊文件

       5   File formats and conventions eg /etc/passwd

           配置文件格式

       6   Games

           游戏

       7   Miscellaneous (including macro packages  and  conventions),  e.g.  man(7),

           groff(7)

           杂项

       8   System administration commands (usually only for root)

          管理类的命令

       9   Kernel routines [Non standard]

          内核常规(非标准)

注意:有些关键字在不止一个章节中存在帮助:

     要查看指定章节中的手册:man#COMMAND   (#代表数字)

 四、man的查看方式

Man的有哪些页已经知道,当然还得知道怎么样查看和翻阅。

man命令的操作方法既less:

 Space,ctrl+v,ctrl+f,ctrl+F,:向文件尾部翻屏:

  b,ctrl+B:向文件首部翻屏:

 d,ctrl+D:向文件尾部翻半屏:

 u,ctrl+U:向文件首部翻半屏:

 RETURN or ctrl+N, e ,ctrl+E, j, ctrl+J:向文件尾部翻一行:

y,ctrl+Y,ctrl+P,k,ctrl+K: 向文件首部翻一行

 q:退出

 #:跳转至第#行:

1G:回到文件首部

 G:翻至文件尾部

 文本搜索:

 /KEYWORD:

以KEYWORD指定的字符串为关键字,从当前位置向文件首部搜索:不区分字符大小写:

              n:跟搜索命令同方向,下一个

              N:跟搜索命令反方向,上一个

五、man的路径

     Man的查看和翻阅知道了  那就的知道man 的命令是在那里,     man命令的路径在那

                [root@localhost etc]# whereis man

            man: /usr/bin/man /usr/share/man /usr/share/man/man1/man.1.gz

 

六、man 的用法

  了解了什么是man,当然得了解man都有哪些用法。

探索这个“男人”

                  图5-1 man的用法

Man有很多选项:

       Non argument options that are  duplicated  either  on  the  command  line,  in$MANOPT, or both, are not harmful.  For options that require an argument, each

       duplication will override the previous argument value.

非参数选项在命令行中复制$MANOPT或者两者都有,并不是所有的选项需要参数,每个重复参数将覆盖前面的参数值。

以下是man运用的例子

探索这个“男人”

                            图5-2 man的例子

EXAMPLES

       man ls

Display the manual page for the item (program) ls.

显示项目手册页或程序 ls

       man -a intro

     Display, in succession, all of the available intro manual pages contained within the manual.  It is possible to quit between successive displays or skip any of them.

    显示,连续,所有可用的介绍手册页中包含的手册。可以退出之间连续显示或跳过其中任何一个。

 

       man -t alias | lpr -Pps

           Format  the manual page referenced by `alias', usually a shell manual page, into the default troff or groff format and pipe it to the printer named ps.  The default output for

           groff is usually PostScript.  man –help should advise as to which processor is bound to the -t option.

       格式手册页面引用的别名”,通常是一个shell手册页面,默认troffgroff格式和管输出叫psgroff的默认输出通常是PostScriptman——帮助应该建议哪些处理器绑定到– t选项。

       man -l -Tdvi ./foo.1x.gz > ./foo.1x.dvi

           This command will decompress and format the nroff source manual page ./foo.1x.gz into a device independent (dvi) file.  The redirection is necessary as the -T flag causes out?

           put to be directed to stdout with no pager.  The output could be viewed with a program such as xdvi or further processed into PostScript using a program such as dvips.

这个命令是解压和使用 groff 的指定设备, ./foo.1x.gz 是一个设备独立文件,重定向是必要的

         输出可以与xdvi等程序或进一步加工成PostScript使用dvips等程序。

 

       man -k printf

           Search the short descriptions and manual page names for the keyword printf as regular expression.  Print out any matches.  Equivalent to apropos -r printf.

. 使用带有-k选项的man命令可以根据关键字搜索联机帮助。如查找printf

       man -f string

    Lookup the manual pages referenced by smail and print out the short descriptions of any found.  Equivalent to whatis -r smail.

      查找命令页中被引用的信息string 输出,短的说明,man -f  等同于 whatis -r smile


    七、命令总结

       想要使用或不知道某个命令,man可以帮助你,man有多个手册页,你想知道这个命令有哪些手册页可使用man -k COMMAND。

   然后你就可以在有的手册页上查看,想到那个手册页可使用  man #  COMMAND   #代表数字。还有…


 

原创文章,作者:N19_king,如若转载,请注明出处:http://www.178linux.com/15831

(0)
N19_kingN19_king
上一篇 2016-05-03 09:28
下一篇 2016-05-04 11:20

相关推荐

  • 初学Linux之程序进程管理工具汇总

    pstree, ps, pidof, pgrep, top, htop, glances, pmap, vmstat, dstat, kill, pkill, job, bg, fg, nohup 

    2017-12-16
  • 第四周博客分享

                    时间匆匆,转眼来马哥已经快一个月了,这一个月对我来说是收获满满,每天都在学到新的东西。       &nbs…

    2017-08-06
  • 105-MHA

    一.MHA简介 1.1.简介         MHA(Master HA ) 是一款开源的 MySQL高可用程序,它为MYSQL 主从复制架构提供了automating master failover 主节点自动迁移功能.MHA在监控到master节点故障时候,会自动提升拥有的数据最近进于主节点的其他从节点为主节点,

    2016-11-27
  • linux的发展与入门

    1,计算机的组成和功能如下: CPU:是由运算器(是用来对数据进行数据运算和逻辑运算), 控制器(是用来对总线的控制,内存寻址的控制,以及对读,写访问的控制), 寄存器和缓存器(都是用来暂存数据的。) 存储器:内存RAM(随机接入存储器)和硬盘:都是用来存储数据的。 输入设备:用来输入需要处理的数据和指令。 输出设备:是用来显示加工过的数据。 2,LINUX…

    Linux干货 2017-07-03
  • shell脚本基础

    shell脚本基础 变量 bash的变量:  环境变量  本地变量  位置变量  特殊变量 本地变量:bash:作用域为整个bash进程 局部变量:作用域为当前代码段 local VARNAME=VALUE 引用变量:${VARNAME} 环境变量:作用域为当前的shell进程及其子进程 export VARNAME=…

    Linux干货 2017-04-16
  • mysql备份还原

    一、前言 数据对于一个公司来说有多重要这点不说大家也知道,数据还在,服务崩溃还可重建。为什么要备份?很简单,天灾人祸。比如硬件故障,软件故障,自然灾害,黑客攻击或自身误操作等因素。这时候备份,恢复数据就显得至关重要了。 二、基础概念 由于备份与恢复需要用到一些必要的知识,故在此先讲解下 2.1二进制日志 myql日志有多种,其中二进制日志文件对数据恢复有很大…

    Linux干货 2015-11-30