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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • 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. Starting iptables Fails with Error “Another app is currently holding the xtables lock”
  2. dumpe2fs Command Examples in Linux
  3. krita: command not found
  4. How to Mount NFS File Systems Using ‘autofs’ in CentOS/RHEL
  5. Command line parameters in shell scripts
  6. Unable to Start RDMA Services on CentOS/RHEL 7
  7. UNIX / Linux : How to lock or disable an user account
  8. swapoff: command not found
  9. How To Enforce Password Complexity For All Users, Including “root”, By Using the “passwdqc” PAM Module CentOS/RHEL
  10. chpasswd Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • nixos-rebuild Command Examples in Linux
  • nixos-option: Command Examples in Linux
  • nixos-container : Command Examples in Linux
  • nitrogen Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright