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.
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communityThe 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
.
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?
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 namedecho
(/bin/echo
), of course, with its own manual page.echo
is that you probably shouldn't use it. Useprintf
instead.