日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux查看帮助信息,命令帮助信息的获取

發布時間:2025/3/17 linux 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux查看帮助信息,命令帮助信息的获取 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

獲取命令的的獲取

Linux中命令分為內建命令和外部命令,內建命令是shell自帶的命令。在獲取命令幫助信息時,先確定命令是內建命令還是外部命令,使用type命令,可以查看命令的類型。外部命令獲取幫助信息有以下幾種方式:

使用命令自帶的簡要格式的使用幫助

使用man幫助文檔手冊,用man命令查看

使用info command獲取命令的在線文檔

查看應用程序自帶的幫助文檔:/usr/share/doc/command-VERSION

主流發行版官方文檔

程序官方文檔

type:

語法

type command

實例

內建命令

[root@localhost ~]# type echo

echo 是 shell 內嵌

外部命令

[root@localhost ~]# type wc

wc 是 /usr/bin/wc

內建命令獲取幫助

內建命令獲取幫助信息使用用help命令

命令格式:

~]#help command

實例:

[root@localhost ~]# 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.

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

-e if the -P option is supplied, and the current working directory

cannot be determined successfully, exit with a non-zero status

The default is to follow symbolic links, as if `-L’ were specified.

Exit Status:

Returns 0 if the directory is changed, and if $PWD is set successfully when

-P is used; non-zero otherwise.

外部命令使用幫助

1. 命令自帶的簡要個格式使用幫助

語法

COMMAND –help

實例

[root@localhost ~]# wc –help

用法:wc [選項]… [文件]…

或:wc [選項]… –files0-from=F

Print newline, word, and byte counts for each FILE, and a total line if

more than one FILE is specified. With no FILE, or when FILE is -,

read standard input. A word is a non-zero-length sequence of characters

delimited by white space.

The options below may be used to select which counts are printed, always in

the following order: newline, word, character, byte, maximum line length.

-c, –bytes print the byte counts

-m, –chars print the character counts

-l, –lines print the newline counts

–files0-from=文件 從指定文件讀取以NUL 終止的名稱,如果該文件被

指定為”-“則從標準輸入讀文件名

-L, –max-line-length 顯示最長行的長度

-w, –words 顯示單詞計數

–help 顯示此幫助信息并退出

–version 顯示版本信息并退出

GNU coreutils online help:

請向 報告wc 的翻譯錯誤

要獲取完整文檔,請運行:info coreutils ‘wc invocation’

2. manual幫助文檔手冊

man命令是Linux下的幫助指令,通過man指令可以查看Linux中的指令幫助、配置文件幫助和編程幫助等信息。幫助文檔手冊存放在/usr/share/man目錄下。

語法

man COMMAND

查看指定#章節幫助

man # COMMAND

選項

-a:在所有的man幫助手冊中搜索

-f:等價于

-P:指定內容時使用分頁程序;

-M:指定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]內核程序代碼的幫助文檔;

手冊各部分功能

NAME:命令名稱及功能說明

SYNOPSIS:命令使用格式摘要;

DESCRIPTION:詳細描述信息;

OPTIONS:選項詳細說明;

AUTHOR:作者;

BUGS:報告程序bug的途徑;

EXAMPLES:使用示例;

SEE ALSO:額外參考;

FILES:相關配置文件

manual手冊中部分符號的意義:

[]:表示該符號內的內容為可選內容

<>:表示該符號內的內容為必選內容

a|b|c:多選一

…:同類內容可出現多次

man page手冊頁操作方法:

手冊頁man page是用less程序來查看的,可以方便地使屏幕上翻和下翻, 所以在man page里可以使用less的所有選項。

快捷鍵

空格鍵:項文件尾翻一屏

b:項文件首部翻一屏

ctrl+d:向文件尾部翻半屏

ctrl+u:向文件首部翻半屏

回車鍵:向文件尾部翻一行

k:向文件首部翻一行

G:跳轉至最后一行

q:quit,退出

末行輸入:

#G(末行模式下輸入):跳轉至指定的#行

1G(末行模式下輸入):跳轉至文件首部

/keyword:從文件首部向文件尾部依次查找,不區分大小寫

?keyword:從文件尾部向文件首部依次查找

實例

查看wc命令幫助信息

[root@localhost ~]# man wc

查看sleep第3章節的幫助信息

[root@localhost ~]# whatis sleep

sleep (1) – 延遲指定數量的時間

sleep (3) – sleep for the specified number of seconds

sleep (1p) – suspend execution for an interval

sleep (3p) – suspend execution for an interval of time

[root@localhost ~]# man 3 sleep

本文來自投稿,不代表Linux運維部落立場,如若轉載,請注明出處:http://www.178linux.com/105081

總結

以上是生活随笔為你收集整理的linux查看帮助信息,命令帮助信息的获取的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。