Flags and options

Have you seen a command that has - or -- with some words or letters after it? For example, consider the command ls -a. What this does mean? Well, the command ls is being given the argument a. This is shorthand for ls --all, which tells the command that it should not ignore entries starting with .. In the next section you will learn what this means, but for now just remember the following

  • A flag is an option, that tells the command to do certain things

  • Traditionally, flags have a shorthand name (e.g. -a) and a longhand name (e.g. --all)

  • You can stack shorthand flags (e.g. -laS is the same as -l -a -S)

  • Capitalisation matters. There is a difference between -b and -B for ls

Last updated