探索这个“男人”

一、前言

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

二、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)
上一篇 2016-05-03 09:28
下一篇 2016-05-04 11:20

相关推荐

  • 网卡路由配置信息及偷懒用法

            对于初学Linux的人来说,配置网卡无疑是比较晕的,各种的配置文件,字段、命令等让人眼花撩乱。所以这一章主要给大多数还在网卡配置路由配置的同学们解惑一、网卡配置基本概念        …

    Linux干货 2017-05-08
  • MAN手册各章节功能介绍及快捷键键位整理

    Linux系统中man命令是用于查询命令使用手册的,使用格式 man + 命令。 当使用man命令之后,系统就会在指定的路径中查询命令的使用手册。其中制定路径为$PATH变量指定的路径,或者/etc/man.config文件中MANPATH中指定的路径  其中/etc/man.config中有如下内容: MANPATH /usr/man …

    Linux干货 2016-10-17
  • find命令基本应用

       简单的find命令查找 Find +路径+条件(支持文件通配)+找到后执行的操作 条件: 可根据文件类型查找:-type   f为普通文件 d为目录文件 l为链接文件(常用) 可根据属主和属组查找:-uid  -gid 可根据时间戳来查找:alime(查看时间)ctime(文件属性更改时间)m…

    Linux干货 2017-04-11
  • DHCP服务介绍及搭建

    DHCP服务介绍及搭建

    2018-01-16
  • raid 0磁盘阵列

    raid0 1  先给sdb磁盘和sdc磁盘分区 [root@localhost ~]# fdisk /dev/sdb    Command (m for help): n Command action   e   extended   p   primary part…

    Linux干货 2017-04-25
  • N25-第六周博客作业

    请详细总结vim编辑器的使用并完成以下练习题 1、复制/etc/rc.d/rc.sysinit文件至/tmp目录,将/tmp/rc.sysinit文件中的以至少一个空白字符开头的行的行首加#; [root@han ~]# cp /etc/rc.d/rc.sysinit /tmp [root@han ~]#&n…

    Linux干货 2017-02-16