Linux系統下常用的幫助man,whatis,info,help總結

1、man

an interface to the on-line reference manuals,在線參考手冊的一個查詢接口,使我們學習過程中國最長的一個幫助命令。

語法 

man [選項] 參數 



man命令後面的數字參數表示的意思:

1   Executable programs or shell commands
#可執行程序或者是普通命令
2   System calls (functions provided by the kernel)
#是系統調用,是內核提供的功能的調用,比如說要調用內核的某個函數不知道要加什麼頭文件。
3   Library calls (functions within program libraries)
#是庫函數,glibc標準C語言庫函數的調用
4   Special files (usually found in /dev)
#特殊文件,也就是/dev下的各種設備文件
5   File formats and conventions eg /etc/passwd
#一些文本文件或者配置文件的詳細幫助信息的顯示
6   Games
#遊戲(基本用不到)
7   Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7)
#其他一些雜項的使用,如Linux文件系統、網絡協議、ASCII code說明等
8   System administration commands (usually only for root)
#是系統管理用的命令,這些命令只能由root使用,如ifconfig
9   Kernel routines [Non standard]
#內核例程


實例1、

#passwd命令的簡單描述。

[root@bogon ~]# man -f passwd
sslpasswd (1ssl)     - compute password hashes
passwd (1)           - update user's authentication tokens
passwd (5)           - password file


實例2、

#查看passwd命令的使用方法

[root@bogon ~]# man 1 passwd
PASSWD(1)                                                      User utilities                                                     PASSWD(1)
NAME
       passwd - update user's authentication tokens
SYNOPSIS
       passwd [-k] [-l] [-u [-f]] [-d] [-e] [-n mindays] [-x maxdays] [-w warndays] [-i inactivedays] [-S] [--stdin] [username]
 …… ……


實例3、

#passwd文件中內容的具體意思

[root@bogon ~]# man 5 passwd
PASSWD(5)                                                Linux Programmer's Manual                                                PASSWD(5)
NAME
       passwd - password file
DESCRIPTION
       The  /etc/passwd  file is a text file that describes user login accounts for the system.  It should have read permission allowed for
       all users (many utilities, like ls(1) use it to map user IDs to usernames), but write access only for the superuser.
   …… ……

實例4、

#sysctl命令的簡要說明

[root@bogon ~]# man -f sysctl
sysctl (8)           - configure kernel parameters at runtime
sysctl (2)           - read/write system parameters


實例5、

#查看sysctl系統調用的有關幫助

[root@bogon ~]# man 2 sysctl
SYSCTL(2)                                                Linux Programmer's Manual                                                SYSCTL(2)
NAME
       sysctl - read/write system parameters
SYNOPSIS
       #include <unistd.h>
       #include <linux/sysctl.h>
       int _sysctl(struct __sysctl_args *args);
       Note: There is no glibc wrapper for this system call; see NOTES.
   ……  ……


實例6、

#查看sysctl在運行時配置內核參數的有關幫助

[root@bogon ~]# man 8 sysctl
SYSCTL(8)                                                  System Administration                                                  SYSCTL(8)
NAME
       sysctl - configure kernel parameters at runtime
SYNOPSIS
       sysctl [options] [variable[=value]] [...]
       sysctl -p [file or regexp] [...]
DESCRIPTION
       sysctl  is  used  to  modify  kernel  parameters at runtime.  The parameters available are those listed under /proc/sys/.  Procfs is
       required for sysctl support in Linux.  You can use sysctl to both read and write sysctl data.



2、whatis

whatis命令常用工具命令 whatis命令是用於查詢一個命令執行什麼功能,並將查詢結果打印到終端上。 whatis命令在用catman命令創建的數據庫中查找command參數指定的命令、系統調用、庫函數或特殊文件名。whatis命令顯示手冊部分的頁眉行。然後可以發出man命令以獲取附加的信息。whatis命令等同於使用man -f命令。 


語法 

whatis 參數


實例 

[root@bogon ~]# whatis cd
cd (1)               - bash built-in commands, see bash(1)
cd (1p)              - change the working directory
[root@bogon ~]# whatis bash
bash (1)             - GNU Bourne-Again SHell
[root@bogon ~]# whatis fdisk
fdisk (8)            - manipulate disk partition table
[root@bogon ~]# whatis man
man (1)              - an interface to the on-line reference manuals
man (1p)             - display system documentation
man (7)              - macros to format man pages




3、-h --help 

外部命令常用的選項,一般外部命令使用這兩選項的比較多,有的外部命令可能只有-h或者--help,有的則兩者都有,具體大家在使用過程中可以摸索着來。



4、info


info命令是Linux下以info格式顯示命令幫助使用的命令。 

info頁面比man page編寫得要更好、更容易理解,更豐富,但man page使用起來確實要更容易得多。一個man page只有一頁,而info頁面幾乎總是將它們的內容組織成多個區段(稱爲節點),每個區段也可能包含子區段(稱爲子節點)。理解這個命令的竅門就是不僅要學習如何在單獨的Info頁面中瀏覽導航,還要學習如何在節點和子節點之間切換。可能剛開始會一時很難在info頁面的節點之間移動和找到你要的東西,真是具有諷刺意味:原本以爲對於新手來說,某個東西比man命令會更好些,但要求對大家的英文水平有很高的要求,我英文水平一般,所以很少使用info這個命令,有英語學得比較好的同行可以學一下info這個命令。下面介紹一下它的幾個常用快捷鍵。

敲?鍵,它就會顯示info的常用快捷鍵。
N鍵:顯示(相對於本節點的)下一節點的文檔內容
P鍵:顯示(相對於本節點的)前一節點的文檔內容
U鍵:進入當前命令所在的主題
M鍵:敲M鍵後輸入命令的名稱就可以查看該命令的幫助文檔了
G鍵:敲G鍵後輸入主題名稱,進入該主題
L鍵:回到上一個訪問的頁面
SPACE鍵:向前滾動一頁
BACKUP或DEL鍵:向後滾動一頁
Q:退出info
命令
?     顯示幫助窗口
       在幫助窗口中:
         Ctrl-x 0      關閉幫助窗口
         Ctrl-x Ctrl-c 關閉整個 Info
         
q      退出 info
n      打開與本 Node 關聯的下一個 Node
p      打開與本 Node 關聯的前一個 Node
u      打開與本 Node 關聯的上一個 Node
l       回到上一次訪問的 Node
m或g 選擇一個菜單項(Node 的名字)
       輸入指定菜單的名字後按回車,打開指定菜單項關聯的 Node
空格鍵 下一頁(PageDown 也可以,下一頁從當前頁的最後兩行開始算起)
       下一個 Node (若當前頁在 Node 文檔的末尾)
Del 鍵 上一頁(PageUp 也可以,上一頁從當前頁的開始兩行開始算起)
       上一個 Node (若當前頁 Node 文檔的開始)
       
b 或 t 或 Home 文檔的開始(b 是 begining 的意思)
e 或 End       文檔的末尾(b 是 ending 的意思)
Ctrl-l  刷新當前頁,若當前文檔顯示情況有問題時
Ctrl-g 取消所鍵入的指令



5、help命令

Shell內建命令,用於顯示shell內部命令的幫助信息。help命令只能顯示shell內部的命令幫助信息。而對於外部命令的幫助信息只能使用man或者info命令查看。


語法 

help(選項)(參數) 


選項 

-s:簡要的顯示每個shell內置命令格式的使用概要。

-d:輸出命令的簡單描述。

-m:詳細顯示命令的使用方法,信息的輸出格式類似於man命令,所以也稱之爲僞幫助命令。

參數 

內部命令:指定需要顯示幫助信息的shell內部命令。


實例1、

#每個命令的簡單描述,也就是說簡單介紹一下這個命令是幹什麼用的。

[root@bogon ~]# help -d help
help - Display information about builtin commands.

#通過上面的輸出我簡單瞭解了help這個bash內置命令是用於顯示shell內部命令的幫助信息的。


實例2、

#短格式輸出命令的是使用方法。

[root@bogon ~]# help -s help
help: help [-dms] [pattern ...]


實例3、

#顯示shell命令的詳細幫助文檔,輸出格式類似於man命令。

[root@bogon ~]# help -m help
NAME
    help - Display information about builtin commands.
SYNOPSIS
    help [-dms] [pattern ...]
DESCRIPTION
    Display information about builtin commands.
    
    Displays brief summaries of builtin commands.  If PATTERN is
    specified, gives detailed help on all commands matching PATTERN,
    otherwise the list of help topics is printed.
    
    Options:
      -doutput short description for each topic
      -mdisplay usage in pseudo-manpage format
      -soutput only a short usage synopsis for each topic matching
    PATTERN
    
    Arguments:
      PATTERNPattern specifiying a help topic
    
    Exit Status:
    Returns success unless PATTERN is not found or an invalid option is given.
SEE ALSO
    bash(1)
IMPLEMENTATION
    GNU bash, version 4.2.46(1)-release (x86_64-redhat-linux-gnu)
    Copyright (C) 2011 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>






發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章