探索這個“男人”

一、前言

正所謂了解一個命令就得了解他的用法,正好是要了解一個人就得了解他的興趣愛好,處事態度以及為人是怎么樣的。

二、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格式和管輸出叫ps。groff的默認輸出通常是PostScript。man——幫助應該建議哪些處理器綁定到– 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.www58058.com/15831

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

相關推薦

  • 登錄后經常出現You have new mail in /var/spool/mail/root的提示

    安裝完LINUX后經常使用終端遠程登錄,登錄后經常出現You have new mail in /var/spool/mail/root的提示,很是煩人。 這東西到底是做什么用的呢?經過查詢才知道這是LINUX的郵年提示功能。LINUX會定時查看LINUX各種狀態做匯總,每經過一段時間會把匯總的信息發送的root的郵箱里,以供有需之時查看。 那要怎么去掉這麻…

    系統運維 2017-08-05
  • 權限

    用戶組和管理權限

    2017-11-30
  • 推薦-HA專題: 編譯安裝并配置DRBD

    HA專題: 編譯安裝并配置DRBD 前言 實驗環境 DRBD介紹 安裝前準備工作 獲取并編譯安裝DRBD 配置DRBD 分區 配置文件 啟動并設置DRBD 格式化并掛載 驗證冗余性 總結 前言 上篇我們講到使用corosync+pacemaker實現MySQL高可用, 但是NFS容易成為單點故障從而導致數據丟失等嚴重問題, 我們可以使用drbd來實現MySQ…

    Linux干貨 2016-04-12
  • 玩轉linux之啟動篇

        想要玩轉linux,首先明白其啟動流程,這里簡單說明一下: CentOS 6啟動流程:    POST –> Boot Sequence(BIOS) –> Boot Loader –> Kernel(ramdisk) –> roo…

    Linux干貨 2016-09-26
  • N25-第十一周

    1、詳細描述一次加密通訊的過程,結合圖示最佳。 發送者: 1.使用單項加密算法提取生成數據的特征碼 2.使用自己的私鑰加密特征碼附加在數據后面 3.生成用于對稱加密的臨時密鑰 4.用此臨時密鑰加密數據和已經使用私鑰加密后的特征碼 5.使用接收方的公鑰加密此臨時密鑰,附加在對稱后的數據后方 接收方: 1.使用自己的私鑰解密的臨時秘鑰;從而獲得對方的對稱密鑰 2…

    2017-06-05
  • 走進Linux(二)

    Linux基礎知識 1、文件管理類命令 mkdir:創建空目錄 格式 mkdir [選項](可跟多個選項) 要創建的目錄名 選項 -p:遞歸創建多個目錄                             &nbsp…

    Linux干貨 2016-09-26
欧美性久久久久