Echo Linux: In this article, we will see, What is an Echo Command in Linux and what is its purpose and examples of using Echo command with different functionalities which are attained by adding Short options, Long options and more. Echo is the Basic and a Built-in Command which we can find in almost all Operating systems like Linux, Unix, Windows and more. Echo can perform certain predefined tasks when they are instructed. As stated above, echo[Echo Linux] is also used widely on Linux based operating terms such as Linux Ubuntu Unity 18.04.1 LTS and more.
- What is the Echo?
- The Syntax of Echo Command
- Table for the Usage of Echo Command[Quick View]
- Detailed Explanation of using Echo Command[With Examples]
- Get in Touch with Us
What is Echo in Computer Environment?
- Echo is a Built-in Command developed for C Shells and Linux Bash which helps the user to batch files to display a line of text(s)/String(s) on a Standard output or on a file.
- Echo Command is widely used on Unix Based Operating systems and since Linux is also a Unix based Operating systems, there are a lot of functions or tasks that an echo command on Linux can perform on Linux based operating systems such as Ubuntu, Mint and more.
The syntax of Echo Command:
The following is the general syntax of Echo Command.
Table for the Usage of Echo Command:
The following table gives a piece of quick information on Echo Command usage and the various Tags and Options available. If you want a Detailed Explanation about each tag and operators then kindly refer the detailed article just below the table.
|-e||This option enables the interpretation of Backslash Escape Sequences|
|-E||This option disables the interpretation of backslash escape sequences|
|\a||Bell Character. An Alert return|
|\n||Adding a new line to your texts|
|\t||Adding Horizontal tab spaces into your texts|
|\v||Adding Vertical tab spaces into your texts|
|\c||Stops displaying output from this point|
|\r||This option is nothing but a Carriage Return.|
|\\||Represents a Backslash(“\”)|
|\b||Performs a Backspace function at the defined point|
|\f||Adding a Form Feed into your texts|
Usage of Echo Command on Linux Ubuntu Unity 18.04.1 LTS- With Examples:
In this section, we will see about the tasks the echo can perform on Linux when they are instructed. We have explained with Step by Step Image explanation for the easy understanding of the users.
If you want to have Quick look on Usage of echo commands, Refer Echo Command Usages Table.
Displaying Texts on Output(Terminal):
If you want to display a text or a line of text on Linux Terminal then you have to use the following command.
Introducing New Line for Texts:
When you are displaying a line of texts and if you wish to display them in one by one line then kindly use the following command. “-e” enables the interpretation of Backslash Escape Sequences and “\n” adds a new line.
Adding Horizontal Tabs to the Texts:
This is similar to using tab option between your texts. This option gives out Horizontal Spaces between your texts. “-e” enables the interpretation of Backlash Escape Sequences and “\t” adds the Horizontal tab between your texts.
Adding Vertical Tabs to your Texts:
This is similar to using tab option between your texts but a vertical tab. This option gives out Vertical Spaces between your texts. “-e” enables the interpretation of Backlash Escape Sequences and “\v” adds the vertical between your texts.
Adding Form Feeds into your Texts:
A form feed is nothing but displaying the output from the same point on the next line. If you take a look at the example then you will have an easy understanding.
How to Use Backspace in your Texts:
“\b” is used to insert a backspace into your texts. It has to be used along with “-e” which enables the interpretation of Backslash Escape sequences. Kindly refer the following example.
Adding Alert(Bell Character) Return to your Texts:
This is really an interesting one. We can able to make an alert using this “\a”. We need to add “-e” which is the interpretation of Backslash Sequences. Adding this in your texts is really simple. Kindly check out the following example and refer the following image for easy understanding.
Ignoring your Texts after certain extent on Output:
This can be best explained with an example. Suppose you have written a full paragraph on the terminal but later u don’t want to display everything that you have typed on the paragraph. In this case, adding “\c” will stop displaying output after it. It has to be used along with “-e”.
Adding Carriage Return to your Texts:
Most of us know very well about Carriage Return. It is nothing but similar to moving to the next line in a typewriter. You can add the carriage return using the tag “\r” and along with “-e” that interprets that Backslash Sequences.
Declaring Values to a Variable using Echo Command:
You can also declare a variable and assign values and display the value on standard output using the echo command.
Get in Touch with Us:
This article provides detailed information on What is an Echo and How it is used in Linux based operating systems and the various usages of Echo Command on Linux based operating systems(Shell Script) such as Linux Ubuntu Unity 18.04.1 LTS and more. If you have any Query then Kindly Comment us and we will revert to you with a solution.
For more interesting articles on Linux, kindly visit TECROBUST