man幫助命令
man [選項] 命令
選項:
-f //查看命令擁有那個級別的幫助
-k //查看和命令相關的所有幫助
man的級別:
1. 查看命令的幫助
2. 查看可被內核調用的函數的幫助
3. 查看函數和函數庫的幫助
4. 查看特殊文件的幫助(主要在/dev文件夾下)
5. 查看配置文件的幫助
6. 查看游戲的幫助
7. 查看其他雜項的幫助
8. 查看系統管理員可用命令的幫助
例子:
[root@centos ~]# man ls
//表示命令級別 //表示用戶命令
LS(1) User Commands LS(1)
NAME
ls - list directory contents //命令的說明
SYNOPSIS
ls [OPTION]... [FILE]... //命令的使用方法
DESCRIPTION //下面內容是ls的選項與簡化選項
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort.
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
//如果命令的選項很多,在此處可以查找你需要的命令
//輸入/-關鍵字 就可以自動跳轉到含有關鍵字的命令上,如:/-d 搜索含有d的選項
//搜索后按n鍵是跳往下一個,shift是跳往上一個
:
注:man命令在某些版本下需要先安裝,方法如下:
yum install man*
--help命令
獲取命令“選項”的幫助
命令 --help
例如:ls --help
shell內部命令幫助
獲取shell內部命令幫助
help shell內部命令
例如:help cd
注:使用whereis區分命令是否是shell內部被命令,例如:
[root@centos ~]# whereis ls
//顯示了ls命令的執行文件/bin/ls 說明這個命令不是shell內部命令
ls: /bin/ls /usr/share/man/man1/ls.1.gz /usr/share/man/man1p/ls.1p.gz
[root@centos ~]# whereis cd
//只顯示的cd的幫助文件 沒有顯示他的執行文件,說明cd是shell內部命令
cd: /usr/share/man/man1/cd.1.gz /usr/share/man/man1p/cd.1p.gz