探索这个“男人”

一、前言

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

二、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

相关推荐

  • 第十二周作业

      1、描述一次完整的http请求处理过程 简介 一次完整的HTTP请求过程从TCP三次握手建立连接成功后开始,客户端按照指定的格式开始向服务端发送HTTP请求,服务端接收请求后,解析HTTP请求,处理完业务逻辑,最后返回一个HTTP的响应给客户端,HTTP的响应内容同样有标准的格式。无论是什么客户端或者是什么服务端,大家只要按照HTTP的协议标准…

    2017-11-12
  • Linux第五周总结

    1、显示当前系统上root、fedora或user1用户的默认shell 2、找出/etc/rc.d/init.d/functions文件中某单词后面跟一组小括号的行,形如:hello(); 3、使用echo命令输出一个绝对路径,使用gerp取出其基名;     扩展:取出其路径名 4、找出ifconfig命令结果中的…

    2017-07-30
  • 文本处理工具应用练习

    练习:  1 、找出ifconfig 命令结果中本机的IPv4 地址 思路:我们使用ifconfig命令可知,ip地址是在第二行,所以我们先筛选出第二行,       第二行中的分隔符看起来很混乱,都是不规则的,有一个空格或多个空格的,没有标准       所以我们最好是建立一个标准分隔,…

    Linux干货 2016-08-08
  • CentOS 系统启动流程[转载]

    Linux(CentOS)系统启动过程大致按照如下顺序: POST –> BootSequence(BIOS) –>Bootloader(MBR) –>Kernel(ramdisk)–>rootfs(readonly)–>switchroot–>/sb…

    Linux干货 2017-01-28
  • 磁盘管理和文件系统

    磁盘结构 设备文件:关联至一个设备驱动程序,进而能够跟与之对应硬件设备进行通信 一切皆文件:open(), read(), write(), close() 设备类型: 块设备:block,存取单位“块”,磁盘 字符设备:char,存取单位“字符”,键盘 设备号码: 主设备号:major number, 标识设备类型 次设备号:minor number, 标…

    Linux干货 2017-04-23
  • Centos网卡bond

    Centos6_Bonding配置: 1.禁用NetworkManager服务  2.创建bonding设备的配置文件 3.添加从属接口1 4.添加从属接口2 5.重启网卡服务 6.查看bond0状态 7.删除bond配置 Centos7_Bonding配置: 1.添加bonding接口 2.添加从属接口1 3.添加从属接口2 4.修改bondin…

    2017-05-17