探索这个“男人”

一、前言

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

二、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
下一篇 2016-05-04

相关推荐

  • linux程序包管理

         首先linux软件程序包和windows中的程序包是不兼容的,所以要在linux上使用windows上的程序,需要使用虚拟化工具。 库级别的虚拟化:     linux : WinE     windows: Cywin 而程序开发语言有多…

    Linux干货 2016-08-24
  • php5.4zend-opcache安装

    公司在做高并发压测,fastcgi,apc,ocache,opcache, 几经考虑,最终考虑用opcache,因为作为 zend-opcache合并为php5.5的分支版本,xcache的前途堪虑, 在环境的安装上竟然折腾了半个下午没有搞定,这个作下问题记录。 先说安装, http://php.net/manual/zh/opcache.installat…

    2015-04-20
  • PXE网络引导系统自动化安装CentOS7

     一.PXE 注意:安装前 selinux 禁用,iptables 关闭 dhcp 服务器静态IP地址  1.PXE的工作原理:      Client向PXE Server上的DHCP发送IP地址请求消息,DHCP检测Client是否合法(主要是检测Client的网卡MAC  &nbsp…

    Linux干货 2017-07-24
  • 链接分析算法之:主题敏感PageRank

      前面的讨论提到。PageRank忽略了主题相关性,导致结果的相关性和主题性降低,对于不同的用户,甚至有很大的差别。例如,当搜索“苹果”时,一个数码爱好者可能是想要看 iphone 的信息,一个果农可能是想看苹果的价格走势和种植技巧,而一个小朋友可能在找苹果的简笔画。理想情况下,应该为每个用户维护一套专用向量,但面对海量用户这种方法显然不可行。所…

    Linux干货 2016-02-17
  • N22-妙手-第一周博客作业

           描述计算机的组成及其功能 1946年冯诺依曼提出冯 诺依曼结构,也称普林斯顿结构,即一种将程序指令存储器和数据存储器合并在一起的存储器结构。根据他的结构,计算机组成是: (1)运算器:负责数据的算术运算和逻辑运算 (2)控制器:  负责对程序信息和数据进行分析,控制并协调其输…

    Linux干货 2016-08-15