今天學習了3種在Centos中如何獲取幫助的命令,現(xiàn)記錄如下:
- help cmd 用于獲取內部命令的幫助信息
如:
[root@Centos7 ~]# help cd
cd: cd [-L|[-P [-e]]] [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.
- cmd --help 用于獲取絕大多數(shù)外部命令的幫助
如:
[root@Centos7 ~]# ls --help
Usage: ls [OPTION]... [FILE]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.
Mandatory arguments to long options are mandatory for short options too.
-a, --all do not ignore entries starting with .
-A, --almost-all do not list implied . and ..
--author with -l, print the author of each file
- man cmd 直接查閱該命令的文檔內容午阵,非常詳盡县袱。
如:
[root@Centos7 ~]# man ls
LS(1) User Commands LS(1)
NAME
ls - list directory contents
SYNOPSIS
ls [OPTION]... [FILE]...
DESCRIPTION
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is speci‐
fied.
Mandatory arguments to long options are mandatory for short options
too.
關于man的使用方法還是需要詳細記錄一下:
man存放在/usr/share/man 文件夾中浑娜,而在該文件夾中,根據(jù)目錄類別式散,又分成了如下九個部分:
1:查看命令的幫助
2:查看可被內核調用的函數(shù)的函數(shù)的版主
3:查看函數(shù)和函數(shù)庫的幫助
4:查看特殊文件的幫助(主要是/dev目錄下的文件)
5:查看配置文件的幫助
6:查看游戲的幫助
7:查看其他雜項的幫助
8:查看系統(tǒng)管理員可用命令的幫助
9:查看和內核相關文件的幫助
- 語法
man [OPTION...] [SECTION]
- 常用參數(shù)
-a:在所有的man幫助手冊中搜索筋遭;
-f:等價于whatis指令,顯示給定關鍵字的簡短描述信息暴拄;
-P:指定內容時使用分頁程序漓滔;
-M:指定man手冊搜索的路徑。