• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

echo Command Examples in Linux

by admin

The echo command is used to display a line of text on the terminal. You can also use the echo command to write text to a file by providing the string after the echo command and redirecting to the file.

Syntax

The syntax of the echo command is:

# echo {string}

echo Command Examples

1. To echo the string on std op device:

# echo "Hi there" 

2. To skip printing the trailing new line:

# echo -n "Hi There" 

3. To enable the interpretation of backslash escapes (****):

# echo -e "Hi\a There"
Operator Interpretation
\\ backslash
\a alert (BEL)
\b backspace
\c produce no further output
\e escape
\f form feed
\n new line
\r carriage return
\t horizontal tab
\v vertical tab
\0NNN byte with octal value NNN (1 to 3 digits)
\xHH byte with hexadecimal value HH (1 to 2 digits)

4. To disable interpretation of backslash escapes:

# echo -E "Hi\! There" 

5. To display the help:

# echo --help 

6. To display the version:

# echo --version 

Filed Under: Linux

Some more articles you might also be interested in …

  1. Sa Command Examples in Linux
  2. chromium-browser: command not found
  3. “aws ses” Command Examples
  4. cal: command not found
  5. What’s different between /bin/false and /sbin/nologin as nologin user’s shell
  6. Common NFS mount options in Linux
  7. mkinitcpio Command Examples in Linux
  8. needrestart: command not found
  9. gixy Command Examples
  10. Linux / UNIX : Examples of find command to find files with specific sets of permissions

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright