echo command in linux is used to display line of text/string that are passed as an argument . This is a built in command that is mostly used in shell scripts and batch files to output status text to the screen or a file.
Syntax :
echo [option] [string]
Displaying a text/string :
Syntax :
echo [string]
Example :

Options of echo command
NOTE :- -e here enables the interpretation of backslash escapes
1. \b : it removes all the spaces in between the text
Example :
echo -e "Geeks \bfor \bGeeks"

2. \c : suppress trailing new line with backspace interpretor ‘-e‘ to continue without emitting new line.
Example :
echo -e "Geeks \cfor Geeks"

In above example, text after \c is not printed and omitted trailing new line.
3. \n : this option creates new line from where it is used.
Example :
echo -e "Geeks \nfor \nGeeks"

4. \t : this option is used to create horizontal tab spaces.
Example :
echo -e "Geeks \tfor \tGeeks"

5. \r : carriage return with backspace interpretor ‘-e‘ to have specified carriage return in output.
Example :
echo -e "Geeks \rfor Geeks"

In the above example, text before \r is not printed.
6. \v : this option is used to create vertical tab spaces.
Example :
echo -e "Geeks \vfor \vGeeks

7. \a : alert return with backspace interpretor ‘-e‘ to have sound alert.
Example :
echo -e "\aGeeks for Geeks

This command when executed, it will produce an alert sound or Bel .
8. echo * : this command will print all files/folders, similar to ls command .
Example :
echo *

9. -n : this option is used to omit echoing trailing newline .
Example :
echo -n "Geeks for Geeks"

Recommended Posts:
- What is the difference between echo, print, and print_r in PHP?
- How to echo HTML in PHP ?
- 'IPCS' command in Linux with examples
- select command in Linux with examples
- Sed Command in Linux/Unix with examples
- ZIP command in Linux with examples
- SORT command in Linux/Unix with examples
- Cat command in Linux with examples
- Head command in Linux with examples
- Tail command in Linux with examples
- wc command in Linux with examples
- tar command in Linux with examples
- atrm command in Linux with examples
- bc command in Linux with examples
- AWK command in Unix/Linux with examples
- tr command in Unix/Linux with examples
- mv command in Linux with examples
- Paste command in Linux with examples
- comm command in Linux with examples
- cmp Command in Linux with examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

