自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

如何列出所有的Bash Shell內(nèi)置命令

系統(tǒng) Linux
shell 內(nèi)置命令就是一個(gè)命令或一個(gè)函數(shù),從 shell 中調(diào)用,它直接在 shell 中執(zhí)行。 bash shell 直接執(zhí)行該命令而無需調(diào)用其他程序。你可以使用 help 命令查看 Bash 內(nèi)置命令的信息。以下是幾種不同類型的內(nèi)置命令。

[[220455]]

內(nèi)置命令包含在 bash shell 本身里面。我該如何在 Linux / Apple OS X / *BSD / Unix 類操作系統(tǒng)列出所有的內(nèi)置 bash 命令,而不用去讀大篇的 bash 操作說明頁?

shell 內(nèi)置命令就是一個(gè)命令或一個(gè)函數(shù),從 shell 中調(diào)用,它直接在 shell 中執(zhí)行。 bash shell 直接執(zhí)行該命令而無需調(diào)用其他程序。你可以使用 help 命令查看 Bash 內(nèi)置命令的信息。以下是幾種不同類型的內(nèi)置命令。

 

內(nèi)置命令的類型

  1. Bourne Shell 內(nèi)置命令:內(nèi)置命令繼承自 Bourne Shell。
  2. Bash 內(nèi)置命令:特定于 Bash 的內(nèi)置命令表。
  3. 修改 Shell 行為:修改 shell 屬性和可選行為的內(nèi)置命令。
  4. 特別的內(nèi)置命令:由 POSIX 特別分類的內(nèi)置命令。

 

如何查看所有 bash 內(nèi)置命令

有以下的命令:

  1. $ help
  2. $ help | less
  3. $ help | grep read

樣例輸出:

  1. GNU bash, version 4.1.5(1)-release (x86_64-pc-linux-gnu)
  2. These shell commands are defined internally. Type `help' to see this list.
  3. Type `help name' to find out more about the function `name'.
  4. Use `info bash' to find out more about the shell in general.
  5. Use `man -k' or `info' to find out more about commands not in this list.
  6.  
  7. A star (*) next to a name means that the command is disabled.
  8.  
  9. job_spec [&] history [-c] [-d offset] [n] or hist>
  10. (( expression )) if COMMANDS; then COMMANDS; [ elif C>
  11. . filename [arguments] jobs [-lnprs] [jobspec ...] or jobs >
  12. : kill [-s sigspec | -n signum | -sigs>
  13. [ arg... ] let arg [arg ...]
  14. [[ expression ]] local [option] name[=value] ...
  15. alias [-p] [name[=value] ... ] logout [n]
  16. bg [job_spec ...] mapfile [-n count] [-O origin] [-s c>
  17. bind [-lpvsPVS] [-m keymap] [-f filen> popd [-n] [+N | -N]
  18. break [n] printf [-v var] format [arguments]
  19. builtin [shell-builtin [arg ...]] pushd [-n] [+N | -N | dir]
  20. caller [expr] pwd [-LP]
  21. case WORD in [PATTERN [| PATTERN]...)> read [-ers] [-a array] [-d delim] [->
  22. cd [-L|-P] [dir] readarray [-n count] [-O origin] [-s>
  23. command [-pVv] command [arg ...] readonly [-af] [name[=value] ...] or>
  24. compgen [-abcdefgjksuv] [-o option] > return [n]
  25. complete [-abcdefgjksuv] [-pr] [-DE] > select NAME [in WORDS ... ;] do COMM>
  26. compopt [-o|+o option] [-DE] [name ..> set [--abefhkmnptuvxBCHP] [-o option>
  27. continue [n] shift [n]
  28. coproc [NAME] command [redirections] shopt [-pqsu] [-o] [optname ...]
  29. declare [-aAfFilrtux] [-p] [name[=val> source filename [arguments]
  30. dirs [-clpv] [+N] [-N] suspend [-f]
  31. disown [-h] [-ar] [jobspec ...] test [expr]
  32. echo [-neE] [arg ...] time [-p] pipeline
  33. enable [-a] [-dnps] [-f filename] [na> times
  34. eval [arg ...] trap [-lp] [[arg] signal_spec ...]
  35. exec [-cl] [-a name] [command [argume> true
  36. exit [n] type [-afptP] name [name ...]
  37. export [-fn] [name[=value] ...] or ex> typeset [-aAfFilrtux] [-p] name[=val>
  38. false ulimit [-SHacdefilmnpqrstuvx] [limit>
  39. fc [-e ename] [-lnr] [first] [last] o> umask [-p] [-S] [mode]
  40. fg [job_spec] unalias [-a] name [name ...]
  41. for NAME [in WORDS ... ] ; do COMMAND> unset [-f] [-v] [name ...]
  42. for (( exp1; exp2; exp3 )); do COMMAN> until COMMANDS; do COMMANDS; done
  43. function name { COMMANDS ; } or name > variables - Names and meanings of so>
  44. getopts optstring name [arg] wait [id]
  45. hash [-lr] [-p pathname] [-dt] [name > while COMMANDS; do COMMANDS; done
  46. help [-dms] [pattern ...] { COMMANDS ; }

另外一種選擇是使用下列命令:

  1. compgen -b
  2. compgen -b | more

 

查看 Bash 的內(nèi)置命令信息

運(yùn)行以下得到詳細(xì)信息:

  1. help command
  2. help read

要僅得到所有帶簡短描述的內(nèi)置命令的列表,執(zhí)行如下:

  1. $ help -d

 

查找內(nèi)置命令的語法和其他選項(xiàng)

使用下列語法去找出更多的相關(guān)內(nèi)置命令:

  1. help name
  2. help cd
  3. help fg
  4. help for
  5. help read
  6. help :

樣例輸出:

  1. :: :
  2. Null command.
  3.  
  4. No effect; the command does nothing.
  5.  
  6. Exit Status:
  7. Always succeeds

 

找出一個(gè)命令是內(nèi)部的(內(nèi)置)還是外部的

使用 type 命令或 command 命令:

  1. type -a command-name-here
  2. type -a cd
  3. type -a uname
  4. type -a :
  5. type -a ls

或者:

  1. type -a cd uname : ls uname

樣例輸出:

  1. cd is a shell builtin
  2. uname is /bin/uname
  3. : is a shell builtin
  4. ls is aliased to `ls --color=auto'
  5. ls is /bin/ls
  6. l is a function
  7. l ()
  8. {
  9. ls --color=auto
  10. }
  11.  

或者:

  1. command -V ls
  2. command -V cd
  3. command -V foo

View list bash built-ins command info on Linux or Unix

View list bash built-ins command info on Linux or Unix 

責(zé)任編輯:龐桂玉 來源: Linux中國
相關(guān)推薦

2010-06-23 17:34:03

Linux Bash

2010-04-07 17:55:12

Unix命令

2010-06-23 17:37:14

Linux Bash

2010-06-23 14:45:02

Linux Bash

2010-06-23 17:16:33

Linux Bash

2010-06-23 16:31:10

Linux Bash

2010-06-23 17:29:07

Linux Bash

2021-08-30 07:50:42

腳本語言命令行

2009-12-25 09:47:05

LinuxShell編程bash

2020-06-24 15:30:39

Bashhistory命令Linux

2019-07-29 15:36:15

Linuxshell內(nèi)置命令

2010-06-23 16:09:40

Linux Bash

2010-06-23 16:35:50

Linux Bash

2017-07-10 17:00:24

程序語言語言特性

2020-07-13 08:12:32

Linux命令瀏覽器

2022-05-02 18:29:35

bashshellLinux

2018-02-01 17:32:30

LinuxUNIXBash Shell

2020-09-02 07:43:02

Bash histor命令Linux

2013-12-20 10:20:34

2022-11-23 08:14:42

bash 腳本test 命令
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號