網頁

搜尋此網誌

2012年2月22日 星期三

Bash Builtin Commands 內建指令

Linux啟動之後所進入的通常就是Bash,面對這個Command-line Interface我們使用者應該如何操作!黑黑的畫面上閃爍著輸入游標,到底有什麼指令可以使用?請求協助輸入help是一個方法,但這只會列出Bash內建的所有指令

列出Bash內建的所有指令與敘述:help -d '*'
  1. % - Resume job in foreground.
  2. (( ... )) - Evaluate arithmetic expression.
  3. . - Execute commands from a file in the current shell.
  4. : - Null command.
  5. [ - Evaluate conditional expression.
  6. [[ ... ]] - Execute conditional command.
  7. alias - Define or display aliases.
  8. bg - Move jobs to the background.
  9. bind - Set Readline key bindings and variables.
  10. break - Exit for, while, or until loops.
  11. builtin - Execute shell builtins.
  12. caller - Return the context of the current subroutine call.
  13. case - Execute commands based on pattern matching.
  14. cd - Change the shell working directory.
  15. command - Execute a simple command or display information about commands.
  16. compgen - Display possible completions depending on the options.
  17. complete - Specify how arguments are to be completed by Readline.
  18. compopt - Modify or display completion options.
  19. continue - Resume for, while, or until loops.
  20. coproc - Create a coprocess named NAME.
  21. declare - Set variable values and attributes.
  22. dirs - Display directory stack.
  23. disown - Remove jobs from current shell.
  24. echo - Write arguments to the standard output.
  25. enable - Enable and disable shell builtins.
  26. eval - Execute arguments as a shell command.
  27. exec - Replace the shell with the given command.
  28. exit - Exit the shell.
  29. export - Set export attribute for shell variables.
  30. false - Return an unsuccessful result.
  31. fc - Display or execute commands from the history list.
  32. fg - Move job to the foreground.
  33. for - Execute commands for each member in a list.
  34. for (( - Arithmetic for loop.
  35. function - Define shell function.
  36. getopts - Parse option arguments.
  37. hash - Remember or display program locations.
  38. help - Display information about builtin commands.
  39. history - Display or manipulate the history list.
  40. if - Execute commands based on conditional.
  41. jobs - Display status of jobs.
  42. kill - Send a signal to a job.
  43. let - Evaluate arithmetic expressions.
  44. local - Define local variables.
  45. logout - Exit a login shell.
  46. mapfile - Read lines from the standard input into an indexed array variable.
  47. popd - Remove directories from stack.
  48. printf - Formats and prints ARGUMENTS under control of the FORMAT.
  49. pushd - Add directories to stack.
  50. pwd - Print the name of the current working directory.
  51. read - Read a line from the standard input and split it into fields.
  52. readarray - Read lines from a file into an array variable.
  53. readonly - Mark shell variables as unchangeable.
  54. return - Return from a shell function.
  55. select - Select words from a list and execute commands.
  56. set - Set or unset values of shell options and positional parameters.
  57. shift - Shift positional parameters.
  58. shopt - Set and unset shell options.
  59. source - Execute commands from a file in the current shell.
  60. suspend - Suspend shell execution.
  61. test - Evaluate conditional expression.
  62. time - Report time consumed by pipeline's execution.
  63. times - Display process times.
  64. trap - Trap signals and other events.
  65. true - Return a successful result.
  66. type - Display information about command type.
  67. typeset - Set variable values and attributes.
  68. ulimit - Modify shell resource limits.
  69. umask - Display or set file mode mask.
  70. unalias - Remove each NAME from the list of defined aliases.
  71. unset - Unset values and attributes of shell variables and functions.
  72. until - Execute commands as long as a test does not succeed.
  73. variables - Common shell variable names and usage.
  74. wait - Wait for job completion and return exit status.
  75. while - Execute commands as long as a test succeeds.
  76. { ... } - Group commands as a unit.
可以看到Bash內建的指令大概有70多個,至於Linux上全部的指令可以參考O'Reilly的Linux Command Directory

心得感想:對於任何電腦系統,務必熟悉最重要的help指令,不知道怎麼操作就請「help」吧,但前提是你要知道有「help」啊!

相關指令:
  • 確認shell的種類:echo $SHELL
  • 顯示Bash的版本:echo $BASH_VERSION

###

沒有留言:

張貼留言

熱門文章