Getting various information from a file or in a terminal is a frequent operation in Linux Operating Systems . It can be used to debug and get various system information. In this article, we are going to discuss the echo command which allows us to perform these tasks.
Echo Command in Linux
In Linux, the echo command is used to show a line of text/string that has been supplied as an argument. This is a built-in command that outputs status text to the screen or a file. It's typically used in shell scripts and batch files. The syntax for this command is "echo [option] [string]".
Options with Echo command
it eliminates all the spaces in between the text
echo -e "hello \bdevelopers"
To continue without emitting a new line, use the backspace interpreter '-e' to suppress the trailing new line.
echo -e "hello \cdevelopers"
This option generates a new line from the current one.
echo -e "hello \ndevelopers"
Horizontal tab spaces are created with this option.
echo -e "hello \tdevelopers"
To have a given carriage return in output, use the backspace interpreter '-e'.
echo -e "hello \rdevelopers"
Vertical tab spaces are created with this option.
echo -e "hello \vdevelopers
To have a sound alert, use the backspace interpreter '-e'.
echo -e "\ahello developers
8. echo *
This command, like the ls command, prints all files and directories.
This option is used to prevent the echoing of the last new line.
echo -n "hello developers"
In this article, we discussed the description of the echo command and its various options. We realize that the echo command provides various options to format the given output. The formatting options can be listing the directories and files, sound alert, generating new lines, tab spaces, etc.
People are also reading: