1. 程式人生 > >Linux help --顯示Bash內建命令的幫助資訊

Linux help --顯示Bash內建命令的幫助資訊

用途說明

help命令顧名思義就是顯示幫助資訊的,它是個Bash內建命令,也只是用來顯示Bash內建命令的幫助資訊的(Display helpful  information about builtin commands)。如果要顯示外部命令的幫助資訊,可以使用man命令或者info命令。在使用LinuxUnix系統時,我們始終要記住,所有的命令幾乎都可以在系統中找到幫助資訊,而通過網際網路找來的資訊只是幫助你迅速入門,而且英文版的資料比中文版的資料可能更靠譜一些,本文也不例外。

常用引數

help命令如果不帶任何引數,則顯示Bash常用內建命令的列表。

格式:help

help命令如果跟上命令名稱,則顯示此命令的詳細幫助資訊。

格式:help COMMAND

如果只想顯示簡單的幫助資訊,加上-s即可。

格式:help -s COMMAND

使用示例

示例一 顯示內建命令列表

[[email protected] ~]# type -a help

helpis a shell builtin      <== 表明help是內建命令

[[email protected] ~]# help

GNU bash, version3.2.25(1)-release (i686-redhat-linux-gnu)

These shell commandsare defined internally.  Type `help' to see this list.

Type `help name' tofind out more about the function `name'.

Use `info bash' tofind out more about the shell in general.

Use `man -k' or`info' to find out more about commands not in this list.

A star (*) next to aname means that the command is disabled.

 JOB_SPEC[&]                      (( expression ))

 . filename[arguments]            :

 [ arg...]                        [[ expression ]]

 alias [-p][name[=value] ... ]     bg [job_spec ...]

 bind[-lpvsPVS] [-m keymap] [-f fi break [n]

 builtin[shell-builtin [arg ...]]  caller [EXPR]

 case WORD in[PATTERN [| PATTERN]. cd [-L|-P] [dir]

 command [-pVv]command [arg ...]   compgen [-abcdefgjksuv] [-o option

 complete[-abcdefgjksuv] [-pr] [-o continue [n]

 declare[-afFirtx] [-p] [name[=val dirs [-clpv] [+N] [-N]

 disown [-h][-ar] [jobspec ...]    echo [-neE] [arg ...]

 enable [-pnds][-a] [-f filename]  eval [arg ...]

 exec [-cl] [-aname] file [redirec exit [n]

 export [-nf][name[=value] ...] or false

 fc [-e ename][-nlr] [first] [last fg [job_spec]

 for NAME [inWORDS ... ;] do COMMA for (( exp1; exp2; exp3 )); do COM

 function NAME{ COMMANDS ; } or NA getopts optstring name [arg]

 hash [-lr] [-ppathname] [-dt] [na help [-s] [pattern ...]

 history [-c][-d offset] [n] or hi if COMMANDS; then COMMANDS; [ elif

 jobs [-lnprs][jobspec ...] or job kill [-s sigspec | -n signum | -si

 let arg [arg...]                 local name[=value] ...

 logout                            popd [+N | -N] [-n]

 printf [-vvar] format [arguments] pushd [dir | +N | -N] [-n]

 pwd[-LP]                         read [-ers] [-u fd] [-t timeout] [

 readonly [-af][name[=value] ...]  return [n]

 select NAME[in WORDS ... ;] do CO set [--abefhkmnptuvxBCHP] [-o opti

 shift[n]                         shopt [-pqsu] [-o long-option] opt

 sourcefilename [arguments]        suspend [-f]

 test[expr]                       time [-p] PIPELINE

 times                             trap [-lp] [arg signal_spec ...]

 true                              type [-afptP] name [name ...]

 typeset[-afFirtx] [-p] name[=valu ulimit [-SHacdfilmnpqstuvx] [limit

 umask [-p][-S][mode]            unalias [-a] name [name ...]

 unset [-f][-v] [name ...]         until COMMANDS;do COMMANDS; done

 variables -Some variable names an wait [n]

 whileCOMMANDS; do COMMANDS; done  { COMMANDS ; }

[[email protected] ~]# help help

help: help [-s][pattern ...]

   Display helpful information about builtin commands.  If PATTERN is

   specified, gives detailed help on all commands matching PATTERN,

   otherwise a list of the builtins is printed.  The -s option

   restricts the output for each builtin command matching PATTERN to

    ashort usage synopsis.

[[email protected] ~]# help -s help

help: help [-s][pattern ...]

[[email protected] ~]#

示例二 非內建命令的幫助資訊

[[email protected] ~]# help error

-bash: help: no helptopics match `error'.  Try `help help' or `man -k error' or `info error'.

[[email protected]b ~]# help ls

-bash: help: no helptopics match `ls'.  Try `help help' or `man -k ls' or `info ls'.

[[email protected] ~]# man ls

示例三 一些常用內建命令的幫助資訊

[[email protected] ~]# help cd

cd: cd [-L|-P] [dir]

   Change the current directory to DIR.  The variable $HOME is the

   default DIR.  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, i.e. `.'.  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, then try the word as a variable

   name.  If that variable has a value, then cd to the value of that

   variable.  The -P option says to use the physical directory structure

   instead of following symbolic links; the -L option forces symbolic links

   to be followed.

[[email protected] ~]# help pwd

pwd: pwd [-LP]

   Print the current working directory.  With the -P option, pwd prints

   the physical directory, without any symbolic links; the -L option

   makes pwd follow symbolic links.

[[email protected] ~]# help if

if: if COMMANDS;then COMMANDS; [ elif COMMANDS; then COMMANDS; ]... [ else COMMANDS; ] fi

   The `if COMMANDS' list is executed.  If its exit status is zero, then the

   `then COMMANDS' list is executed.  Otherwise, each `elif COMMANDS' list is

   executed in turn, and if its exit status is zero, the corresponding

   `then COMMANDS' list is executed and the if command completes.  Otherwise,

   the `else COMMANDS' list is executed, if present.  The exit status of the

   entire construct is the exit status of the last command executed, or zero

   if no condition tested true.

[[email protected] ~]# help for

for: for NAME [inWORDS ... ;] do COMMANDS; done

   The `for' loop executes a sequence of commands for each member in a

   list of items.  If `in WORDS ...;' is not present, then `in"[email protected]"' is

   assumed.  For each element in WORDS, NAME is set to that element, and

   the COMMANDS are executed.

for ((: for (( exp1;exp2; exp3 )); do COMMANDS; done

   Equivalent to

       (( EXP1 ))

       while (( EXP2 )); do

               COMMANDS

               (( EXP3 ))

       done

   EXP1, EXP2, and EXP3 are arithmetic expressions.  If any expression is

   omitted, it behaves as if it evaluates to 1.

[[email protected] ~]# help while

while: whileCOMMANDS; do COMMANDS; done

   Expand and execute COMMANDS as long as the final command in the

   `while' COMMANDS has an exit status of zero.

[[email protected] ~]# helpcase

case: case WORD in[PATTERN [| PATTERN]...) COMMANDS ;;]... esac

   Selectively execute COMMANDS based upon WORD matching PATTERN.  The

   `|' is used to separate multiple patterns.

[[email protected] ~]# help echo

echo: echo [-neE][arg ...]

   Output the ARGs.  If -n is specified, the trailing newline is

   suppressed.  If the -e option is given, interpretation of the

   following backslash-escaped characters is turned on:

       \a      alert (bell)

       \b      backspace

       \c      suppress trailing newline

       \E      escape character

       \f      form feed

       \n      new line

       \r      carriage return

       \t      horizontal tab

       \v      vertical tab

       \\      backslash

       \0nnn   the character whose ASCII code is NNN (octal).  NNN canbe

               0 to 3 octal digits

   You can explicitly turn off the interpretation of the above characters

   with the -E option.

[[email protected] ~]#

相關推薦

Linux help --顯示Bash命令幫助資訊

用途說明 help命令顧名思義就是顯示幫助資訊的,它是個Bash內建命令,也只是用來顯示Bash內建命令的幫助資訊的(Display helpful  information about builtin commands)。如果要顯示外部命令的幫助資訊,可以使用man命令或者info命令。在使用Linux或

bash命令mapfile:讀取檔案內容到陣列

bash提供了兩個內建命令:readarray和mapfile,它們是同義詞。它們的作用是從標準輸入讀取一行行的資料,然後每一行都賦值給一個數組的各元素。顯然,在shell程式設計中更常用的是從檔案、從管道讀取,不過也可以從檔案描述符中讀取資料。 需要先說明的是,shell並不像其它專門的程式語言對陣列、列表

Bash命令-shopt

1.shopt 命令簡介 2.shopt 引數含義說明 3.shopt 使用示例 1)extglob 引數 shopt 命令用於顯示和設定shell中的行為選項,通過這些選項以增強shell易用性。 shopt命令若不帶任何引數選項,則可以顯示所有可以設定的shell操作選項。

Linux/Unix Bash Shell 所有命令

對於bash shell本身包含的內建命令,我們如何在Linux / Apple OS X / *BSD / 類Unix作業系統上全部列出他們,並且無需查閱大量得bash手冊? shell 內建命令就是一個命令或一個函式,從 shell 中呼叫,它直接在 shell 中執行。bash shell

基本操作,和常見的linux命令

關於內建命令的操作1.創建一個shell.sh的一個文件夾,再編輯:2.進入文件編輯,必須要加上文件頭:執行shel腳本,一般有兩種方法:(1)當前bash的所在目錄地址 + 腳本文件名字。 (2)用c

Linux bash命令

uil continue link pri disown his rul getopt com man cd -->查詢不到,所以會提示bash的內置命令 . alias bg bind break builtin caller cd comman

Linux 命令和系統命令

1.什麼是build in命令: shell內建命令是指bash(或其它版本)工具集中的命令。一般都會有一個與之同名的系統命令,比如bash中的echo命令與/bin/echo是兩個不同的命令,儘管他們行為大體相仿。當在bash中鍵入一個命令時系統會先看他是否是一個內建命令,如果不是才會檢視是否是系統

Linux(小專案)————shell的實現,包含重定向、命令

bash原理: 通過上面bash的原理我們可以,瞭解到shell的框架與流程: 1.等待使用者輸入命令。 2.解析使用者輸入的字串。 3.建立子程序執行exec程式替換 4.父程序等待子程序退出。 迴圈執行1~4步驟,即可完成my_shell。 最簡單版本的my_shell實現:

理解Linux命令與外部命令

在學習後面bash shell知識點前,我們得搞明白一件事,什麼是內建命令與外部命令? 你可能聽到過“內建命令”這個術語,大多都是如下解釋,今天換個方式來說,感覺大家會更能理解。 Linux的命令可以分為內部命令和外部命令: 內建命令在系統啟動時就調入記憶體,是常駐記憶體的,

Linux程式設計 10 (shell外部命令命令,alias ,type命令)

一.  內部命令   Linux命令有內部命令(內建命令)和外部命令之分,內部命令和外部命令功能基本相同,但也有些細微差別。內部命令不需要使用子程序來執行,它們已經和shell編譯成一體,作為shell工具的組成部分存在。不需要藉助外部程式檔案來執行。它們是一些比較簡單的linux系統命令,如exit,his

Linux Shell 命令 : builtin 命令詳解

builtin命令用於執行指定的shell內部命令,並返回內部命令的返回值。builtin命令在使用時,將不能夠再使用Linux中的外部命令。當系統中定義了與shell內部命令相同的函式時,使用builtin顯式地執行shell內部命令,從而忽略定義的shell函式。 語法

Linux命令列表

source   也就是. 命令,使shell讀取指定shell程式檔案並執行 alias   設定命令別名 bg   命令後臺執行 bind   顯示和設定命令列中的鍵盤組合按鍵 break builtin caller cd   切換工作目錄 command    co

CentOS 7 Shell指令碼程式設計第六講 Bash Shell 外部命令命令

開發十年,就只剩下這套架構體系了! >>>   

CentOS 7 Shell指令碼程式設計第七講 Bash Shell 常用命令簡介

開發十年,就只剩下這套架構體系了! >>>   

Linux自學筆記——計算機基礎以及命令幫助的獲取

linux man 計算機基礎知識: 計算機的主要組成部分: 運算器、控制器、存儲器、輸入設備、輸出設備 CPU:運算器,控制器 bus:總線 memory: 編址存儲設備 IO:與外部部件交互程序的運行模

Shell命令與運行方法

col shell 執行 log family i++ 整數 執行文件 讀取 1. !# /bin/bash 這句話是shell腳本的第一行,/bin/bash表示腳本的解釋器位置。 2. 腳本的運行:     (1)bash

centos中的命令與普通命令的區別

命令centos中的內建命令與普通命令的區別

bash命令mapfile:讀取文件內容到數組

定義 數據 選項 大量 註意 option 影響 如果 多個 bash提供了兩個內置命令:readarray和mapfile,它們是同義詞。它們的作用是從標準輸入讀取一行行的數據,然後每一行都賦值給一個數組的各元素。顯然,在shell編程中更常用的是從文件、從管道讀取,不過

Fiddler命令

  Fiddler左下角有一個命令框    【基礎命令】   【舉例說明】 ?   回車之後,匹配的內容如下圖    stop   【斷點命令】 FIddler斷點功能就是將請求截獲下來,

Flask命令列工具—CLI

應用發現 flask命令在Flask庫安裝後可使用,使用前需要正確配置FLASK_APP環境變數以告知使用者程式所在位置。不同平臺設定方式有所不同。 Unix Bash (Linux, Mac, etc.): $ export FLASK_APP=hello $ flask run Windows