探索这个“男人”

一、前言

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

二、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干货 2016-09-06
  • 2016年8月11号学习博客

    shell脚本编程 shell脚本是包含一些命令或声明,并符合一定格式的文本文件 shell脚本的用途有: 自动化常用命令 执行系统管理和故障排除 创建简单的应用程序 处理文本或文件 命令查询过程:别名–>内部变量–>hash–>$PATH ~]#bash -n 检测脚本语法错误 ~]#bash -x 顺…

    Linux干货 2016-08-15
  • Linux的文件系统和目录

    Linux的文件系统和目录 Linux目录和Windows目录有着很大的不同,Linux目录类似一个树,最顶层是其根目录,如下图: 文件系统和目录:   详细用法如下 / bin     存放用户使用的基本命令(可执行程序,二进制文件),它是不能单独分区的 boot    跟内核…

    2017-03-26
  • MBR分区和GPT分区详解

    什么是磁盘分区?               磁盘分区是使用分区编辑器(partition editor)在磁盘上划分几个逻辑部分,盘片一旦划分成数个分区(Partition),不同类的目录与文件可以存储进不同的分区。越多分区,也就有更多不同的地方,可以将文件的性质区分得更细,按…

    Linux干货 2016-08-29
  • sed文本编辑工具

    用法:sed[option]… ‘script’ inputfile…常用选项:-n:不输出模式空间内容到屏幕,即不自动打印-e: 多点编辑-f:/PATH/SCRIPT_FILE: 从指定文件中读取编辑脚本-r: 支持使用扩展正则表达式-i.bak: 备份文件并原处编辑script:‘地址命令…

    Linux干货 2017-05-02
  • 第二周的作业

    1、Linux上的文件管理类命令都有哪些,其常用的使用方法及其相关示例演示。 命令:ls NAME:用于列出目录的内容; SYNOPSIS:ls [OPTION]… [FILE]… FILE: 如果FILE是个文件的话,则显示文件名; 如果FILE是个目录的话,则列出目录的内容; OPTION: -l:显示长格式的信息,一共包含了7个…

    Linux干货 2016-11-23