←  linux commands

Views:

echo command

It is used to print something on the terminal through standard output (stdout).

Syntax: echo [options] [string]

Example:

echo Hello World
example-output

Options:

-n Do not print new line

By default echo command prints the message on a new line, in order to avoid that we can add a this flag.

Example:

echo -n HeLLo World
no-new-line-output
-e, -E Enable/Disable interpreting backslash escape characters respectively.

In order to enable/disable interpreting backslash escape characters we can use this flag.

Backslash escape characters
  • \b    Backspace
  • \c    Suppress trailing newline
  • \f    Form feed
  • \n    New line
  • \t    Horizontal tab
  • \v    Vertical tab

Example

echo -E "Hello\nWorld"
escape-chars-interpreting-output