0

I am fairly new to Linux and all I know for sure about the command echo is that when you type a word after it, such as echo Linux!, it prints out Linux!. Is there anything else echo does?

I don't think it is a duplicate.

Zanna
  • 69,223
  • 56
  • 216
  • 327
SealsRock12
  • 15
  • 1
  • 1
  • 8
  • `echo` is usually a built-in command provided by the shell; see your shell's manual page for details. There is also an independent program named `echo` (`/bin/echo`), of course, with its own [manual page](http://manpages.ubuntu.com/manpages/xenial/en/man1/echo.1.html). – AlexP Dec 19 '17 at 01:26
  • One important thing to know about `echo` is that you probably shouldn't use it. Use `printf` instead. – fkraiem Dec 19 '17 at 03:48

1 Answers1

4

The syntax for echo is:

echo [option(s)] [string(s)]

You can pass options to it in order to have a better intended results. As example, -e acts as interpretation of escaped characters that are backslashed. Using option \b – backspace with backslash interpretor -e which removes all the spaces in between.So when running the following command:

$ echo -e "Tecmint \bis \ba \bcommunity \bof \bLinux \bNerds" 

That produces:

TecmintisacommunityofLinuxNerds 

You can run man [command] to know what are its options.

man echo

Edit:

According to @Zanna comment which is attached to this answer. When we man echo, we are not showing the manual of the built-in echo . To read short documentation about the built-in echo we need to run help echo .

ndrwnaguib
  • 168
  • 9
  • 1
    note that the `man` page that comes up when you type `man echo` is not the `man` page for the builtin `echo` you are normally using in an interactive shell, but for `/bin/echo`. The `man` page does mention this... To read the short documentation for the Bash builtin `echo`, you can run `help echo`. See [Why is there a /bin/echo and why would I want to use it?](//askubuntu.com/q/960822) – Zanna Dec 19 '17 at 19:20
  • Oh thank you for such a beneficial information. – ndrwnaguib Dec 19 '17 at 19:21