Command forms

General command form

In a shell (bash here), there are a multitude of commands accessible by the command interpreter. However, these commands (almost) all follow the same syntax:

command [option] [argument]
  • command is the name of the command to be executed

  • The [...] in [option] and [argument] means that the options and arguments are optional. So the command can be called alone and will then be executed with its default options.

  • The various components of the commands are separated by spaces.

  • [option] corresponds to the options. They are usually of the form -o (with a dash) or --option (long version with two dashes). Options can sometimes be followed by arguments specific to the options (for example -o toto or --option=toto). If several options are defined, they can often be abbreviated (eg -a -b becomes -ab).

  • [argument] matches the command's own arguments.

Example:

ls
ls directory
ls -d directory
ls -l -a
ls -la
ls -la directory