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.

2
  • 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.
    – AlexP
    Dec 19, 2017 at 1:26
  • One important thing to know about echo is that you probably shouldn't use it. Use printf instead.
    – fkraiem
    Dec 19, 2017 at 3:48

1 Answer 1

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 .

2
  • 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?
    – Zanna
    Dec 19, 2017 at 19:20
  • Oh thank you for such a beneficial information.
    – ndrwnaguib
    Dec 19, 2017 at 19:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.