M20 – 1- 第二周博客(1):幫助手冊查詢的使用

Linux系統中存在諸多的命令,而這些命令分為內鍵命令和外部命令。如何查詢命令屬于內部還是外部呢。前一篇博客已經介紹type命令,type命令可以區分命令屬于內部還是外部,下面舉個例子:

blob.png

為什么這一期博客還重復講如何區分內部與外部命令呢,因為在man手冊查詢中,內部命令并不是使用man查詢幫助手冊,僅僅使用與外部命令,那內鍵命令如何查詢呢,接下來要講的就是help命令,help命令是用于查詢內鍵命令的。

Linux命令的幫助查詢以及獲取

1、內鍵命令幫助手冊查詢

help命令

簡介:
Display information about builtin commands.
格式:
help [-dms] [pattern ...]
實例1:
[root@centos6 ~]# help cd  #cd為內鍵命令,因此用help命令查詢,可獲取cd的幫助手冊
cd: cd [-L|-P] [dir]
    Change the shell working directory.
    
    Change the current directory to DIR.  The default DIR is the value of the
    HOME shell variable.
    
    The variable CDPATH defines the search path for the directory containing
    DIR.  Alternative directory names in CDPATH are separated by a colon (:).
    A null directory name is the same as the current directory.  If DIR begins
    with a slash (/), then CDPATH is not used.
    
    If the directory is not found, and the shell option `cdable_vars' is set,
    the word is assumed to be  a variable name.  If that variable has a value,
    its value is used for DIR.
    
    Options:
        -L	force symbolic links to be followed
        -P	use the physical directory structure without following symbolic
    	links
    
    The default is to follow symbolic links, as if `-L' were specified.
    
    Exit Status:
    Returns 0 if the directory is changed; non-zero otherwise.

2、外部命令幫助手冊查詢

man命令

簡介:
man - an interface to the on-line reference manuals
格式:
man COMMAND
實例1:
[root@centos6 ~]# type ifconfig
ifconfig is /sbin/ifconfig
[root@centos6 ~]# man ifconfig




IFCONFIG(8)                Linux Programmer’s Manual               IFCONFIG(8)

NAME
       ifconfig - configure a network interface

SYNOPSIS
       ifconfig [interface]
       ifconfig interface [aftype] options | address ...

NOTE
       This program is obsolete!  For replacement check ip addr and ip link.  For statistics use ip -s link.

3、man幫助手冊中的段落說明

3.1、man手冊頁

man手冊頁包含:man1..man8,、
分別講的是(1)man1: 用戶命令、man2: 系統調用、man3: C庫調用、man4: 設備文件及特殊文件、man5: 配置文件格式、man6: 游戲、man7: 雜項、man8: 管理類的命令

blob.png

3.2、man命令的配置文件

man命令的配置文件:/etc/man.config
平常在安裝某些程序的時候,程序自身也自帶man手冊,安裝完程序后,不但要對該程序的自身命令做環境變量,也要對做的環境變量設置man手冊,如何配置該程序的命令man手冊呢,直接在
man的配置文件中添加該程序的man路徑即可。如下圖:

blob.png

3.3、幫助手冊中的段落說明

NAME          //名稱
SYNOPSIS        //簡介
DESCRIPTION      //描述
OPTIONS        //選項
EXAMPLES        //實例
AUTHOR         //作者
REPORTING BUGS    //錯誤報告
SEE ALSO        //參見
而SYNOPSIS中可分為
[]:可選的內容
<>: 必選的內容
a|b:二選一
...: 同一內容可出現多次

3.4、man命令查詢的操作方法

(1)翻頁查詢:

Space, ^V, ^f, ^F:  向文件尾翻屏;
b, ^B:  向文件首部翻屏;
d, ^D:  向文件尾部翻半屏;
u, ^U:  向文件首部翻半屏;
RETURN, ^N, e, ^E or j or ^J:  向文件尾部翻一行;
y or ^Y or ^P or k or ^K: 向文件首部翻一行;
q:  退出;

(2)跳轉查詢:

1G:  回到文件首部
G:  翻至文件尾部

(3)文本搜索:

KEYWORD: 
以KEYWORD指定的字符串為關鍵字,從當前位置向文件尾部搜索;不區分字符大小寫;
n: 下一個
N:上一個
				
?KEYWORD:
以KEYWORD指定的字符串為關鍵字,從當前位置向文件首部搜索;不區分字符大小寫;
n: 跟搜索命令同方向,下一個
N:跟搜索命令反方向,上一個

4、info命令

簡介:
 info - read Info documents
格式:
info [OPTION]... [MENU-ITEM...]
[root@centos6 ~]# type info   #info命令屬于外部命令
info is /usr/bin/info
[root@centos6 ~]# info ifconfig   #info命令也可以查詢外部命令的幫助手冊,且比man命令的詳解更簡潔

File: *manpages*,  Node: ifconfig,  Up: (dir)

IFCONFIG(8)                Linux Programmer’s Manual               IFCONFIG(8)



NAME
       ifconfig - configure a network interface


SYNOPSIS
       ifconfig [interface]
       ifconfig interface [aftype] options | address ...


NOTE
       This  program  is obsolete!  For replacement check ip addr and ip link.
       For statistics use ip -s link.


DESCRIPTION
       Ifconfig is used to configure the kernel-resident  network  interfaces.
       It is used at boot time to set up interfaces as necessary.  After that,
       it is usually only needed when  debugging  or  when  system  tuning  is
       needed.

info命令查詢的操作方法

方向鍵: PgUp,PgDn 導航
Tab鍵: 移動到下一個鏈接
d: 顯示主題目錄
Home: 顯示主題首部
Enter: 進入選定鏈接
n/p/u/l: 進入下/前/上一層/最后一個鏈接
s: 文字文本搜索
q: 退出info

5、利用網絡資源查詢命令的使用

(1)http://www.redhat.com/docs
(2)http://os.51cto.com/linuxman/
(3)seo搜索引擎查詢,Google、baidu

原創文章,作者:Aleen,如若轉載,請注明出處:http://www.www58058.com/26852

(0)
AleenAleen
上一篇 2016-08-02
下一篇 2016-08-02

相關推薦

  • N24_阿龍弟弟 學習計劃/目標/宣言

    嗨,大家好,這是我的第一篇文章。很高興來到馬幫門徒這個大家庭。 學習計劃:沒有自己的計劃,跟著馬哥課程的進度來吧,以周為單位,確保每周任務完成; 學習目標:掌握應有的運維能力,做一名合格的Linux運維工程師,提升自我價值,過更好的生活; 學習宣言:Be a better man(Not Only Linux)!

    Linux干貨 2016-10-25
  • Linux文件類型以及顏色標識

    1、Linux文件類型介紹   Linux系統不同于window系統,兩者文件類型也有很大的差異。Linux文件類型和Linux文件的文件名所代表的意義是兩個不同的概念。我們通過一般應用程序而創建的比如file.txt、file.tar.gz,這些文件雖然要用不同的程序來打開,但放在Linux文件類型中衡量的話,大多是常規文件(也被稱為普…

    Linux干貨 2016-10-17
  • 計算機的發展及組成

    計算機發展 計算機(Computer):俗稱電腦,是一種能接收和存儲信息,并按照存儲在其內部的程序對海量數據進行自動、高速地處理,然后把處理結果輸出的現代化智能電子設備。 1946年,世界上誕生了第一臺計算機,用于軍事,計算彈道。 1946年數學家馮.諾依曼提出馮諾依曼體系結構,即所有計算機由運算器、控制器、存儲器、輸入設備、輸出設備組成,所有遵循馮.諾依曼…

    Linux干貨 2017-07-13
  • 自用vim環境參數設置

    基本顯示設置 set nu mber 顯示行號 syntax on 語法高亮 set cursorline 用淺色高亮當前行 set ruler 顯示標尺 set showcmd 輸入的命令顯示出來,看的清楚些 set cmdheight=1 命令行(在狀態行下)的高度,設置為1 set tabst…

    Linux干貨 2017-04-24
  • Linux的用戶,組及文件權限管理

    Linux用戶與組的創建,刪除,屬性修改,文件權限管理

    Linux干貨 2018-02-24
  • Tomcat基礎及常見使用入門

    Tomcat的簡單介紹,安裝,以及簡單的配置運用

    2017-09-11
欧美性久久久久