Verbosity vs. Quietness in CLI

In sum, verbosity makes the command-line interface (CLI) tool display more detailed information than usual. Quietness is the opposite, in which CLI displays fewer details or nothing.

In a well-written CLI tool, there is often an option, such as --verbose or its abbreviated version -v, to enable the verbose mode. This mode can be talkative to either the standard output and/or to the standard error. When enabled, this mode prints errors, warnings, debug information, etc. A CLI tool may suggest a different level of wordiness, for instance with the options -v, -vv, or more -vvv.

On the opposite hand, the option -q or -s silences or quiets the CLI tool output.

Example

We will focus on the following command:

curl www.example.com 2>&1 | wc -l

  • The curl command is a famous command that simply retrieves data served on a sample website, here www.example.com, and display it to the standard output.
  • 2>&1 means the content of the standard error outputfile descriptor 2, designated by 2 will be redirected to the standard outputfile descriptor 1, designated by 1.
  • The output redirection is done using the operator >.
  • The & symbol stands for: the variable name before and after the symbol (2 and 1) are considered file descriptors and not filenames.
  • The output result of the first part of the command (curl www.example.com 2>&1) will be processed using wc -l.
  • wc is a tool that counts newlines, words, and bytes – with the option -l, it will count the output lines.

In short, the previous command will count the number of lines retrieved from the example website, including possible errors.

Terminal 1
Terminal
Loading...

As you can see, the number of counted lines differs depending on the use, or not, of -s and -v.

Give it a try on your terminal!

Free Resources