Command documentation

Precedence is the same here as you might be familiar with from arithmetic. For example, multiplication has higher precedence than addition, so 2 + 3 × 4 is equal to 2 + (3 × 4), or 14. A common use case for this is to define a function with the same name as a file command to set some default options. As a quick example, here’s how we would tell `grep` to use colored output by default:

Command documentation#

This chapter will help you find documentation for the commands on your machine.

Each type of command is documented in different ways. There are five types of commands: alias, keyword, function, builtin and file, in order of decreasing precedence.

Precedence is the same here as you might be familiar with from arithmetic. For example, multiplication has higher precedence than addition, so 2 + 3 × 4 is equal to 2 + (3 × 4), or 14. A common use case for this is to define a function with the same name as a file command to set some default options. As a quick example, here’s how we would tell grep to use colored output by default:

command suppresses shell function lookup, forcing Bash to refer to the file command within the function. Otherwise, the function would just recurse forever.

  • Aliases don’t provide help, because they are just shorthand for a command with some arguments. They are also considered deprecated in favor of functions because of some technical shortcomings, so we’ll ignore them for now.

  • Standalone function are very rarely self–documenting, so we’ll ignore those as well.

  • Keywords are things like if, time, and [[, which are parsed differently from other commands. For example,