{"id":12561,"date":"2021-11-29T08:22:45","date_gmt":"2021-11-29T08:22:45","guid":{"rendered":"https:\/\/linuxways.net\/?p=12561"},"modified":"2021-12-07T04:12:09","modified_gmt":"2021-12-07T04:12:09","slug":"echo-command-in-linux","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/centos\/echo-command-in-linux\/","title":{"rendered":"Echo command in Linux"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p>The echo command is a useful choice for writing text in a terminal window. Its main task is to display text or string but not necessarily static text.<\/p>\n<p>This command is available and is commonly used in shell scripts and batch files. And it is often used to output the results of other commands.<\/p>\n<p>Here we will show you how to use the echo command in Linux as we did below. Hope you understand.<\/p>\n<h2>The syntax<\/h2>\n<p>The syntax:<\/p>\n<pre>$ echo [option] [string]<\/pre>\n<p>To display a text or string:<\/p>\n<pre>$ echo [string]<\/pre>\n<p>For example:<\/p>\n<pre>$ echo \"Hello\"<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"969\" height=\"73\" class=\"wp-image-12562\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-581.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-581.png 969w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-581-300x23.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-581-768x58.png 768w\" sizes=\"auto, (max-width: 969px) 100vw, 969px\" \/><\/p>\n<h2>Options<\/h2>\n<p><strong>1. \\b<\/strong> remove all spaces<\/p>\n<p>Example:<\/p>\n<pre>$ echo -e \"Hello \\bWorld\"<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"970\" height=\"69\" class=\"wp-image-12563\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-582.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-582.png 970w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-582-300x21.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-582-768x55.png 768w\" sizes=\"auto, (max-width: 970px) 100vw, 970px\" \/><\/p>\n<p>You must use -e for the command to understand the meaning of &#8220;\\&#8221;<\/p>\n<p><strong>2. \\c <\/strong> remove the line after the option<\/p>\n<p>Example:<\/p>\n<pre>$ echo -e \"Hello \\cWorld\"<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"970\" height=\"49\" class=\"wp-image-12564\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-583.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-583.png 970w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-583-300x15.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-583-768x39.png 768w\" sizes=\"auto, (max-width: 970px) 100vw, 970px\" \/><\/p>\n<p><strong>3. \\n<\/strong> split newline<\/p>\n<p>Example:<\/p>\n<pre>$ echo -e \"Hello \\nWorld\"<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"969\" height=\"85\" class=\"wp-image-12565\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-584.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-584.png 969w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-584-300x26.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-584-768x67.png 768w\" sizes=\"auto, (max-width: 969px) 100vw, 969px\" \/><\/p>\n<p><strong>4. \\t<\/strong> separated by horizontal tab<\/p>\n<p>Example:<\/p>\n<pre>$ echo -e \"Hello \\tWorld\"<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"968\" height=\"65\" class=\"wp-image-12566\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-585.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-585.png 968w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-585-300x20.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-585-768x52.png 768w\" sizes=\"auto, (max-width: 968px) 100vw, 968px\" \/><\/p>\n<p><strong>5. \\r <\/strong> remove the line before the option<\/p>\n<p>Example:<\/p>\n<pre>$ echo -e \"Hello \\rWorld\"<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"968\" height=\"69\" class=\"wp-image-12567\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-586.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-586.png 968w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-586-300x21.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-586-768x55.png 768w\" sizes=\"auto, (max-width: 968px) 100vw, 968px\" \/><\/p>\n<p><strong>6. \\v <\/strong> separated by vertical tab<\/p>\n<p>Example:<\/p>\n<pre>$ echo -e \"Hello \\vWorld\"<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"969\" height=\"86\" class=\"wp-image-12568\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-587.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-587.png 969w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-587-300x27.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-587-768x68.png 768w\" sizes=\"auto, (max-width: 969px) 100vw, 969px\" \/><\/p>\n<p><strong>7. echo*<\/strong> list all files\/folders<\/p>\n<p>Example:<\/p>\n<pre>$ echo *<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"968\" height=\"94\" class=\"wp-image-12569\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-588.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-588.png 968w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-588-300x29.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-588-768x75.png 768w\" sizes=\"auto, (max-width: 968px) 100vw, 968px\" \/><\/p>\n<h2>Conclusion<\/h2>\n<p>We have shown you how to use echo command in Linux.<\/p>\n<p>Thanks for referring!<\/p>","protected":false},"excerpt":{"rendered":"<p>Introduction The echo command is a useful choice for writing text in a terminal window. Its main task is to display text or string but not necessarily static&hellip;<\/p>","protected":false},"author":1,"featured_media":12773,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,4,5,83,165,2],"tags":[719,35],"class_list":["post-12561","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-debian","category-mint","category-opensuse","category-red-hat","category-ubuntu","tag-echo-command","tag-linux"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/12561","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=12561"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/12561\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/12773"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=12561"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=12561"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=12561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}