echo command in Linux | Linux for Beginners 2021
Video Linux of this tutorial :-
echo command is one of most basic as well frequently used
command in Linux to display line of text or string and argument passed to echo
printed to the standard output. This is build in command that is mostly used in
shell scripting and batch files.
So lets echo command in linux. Open terminal
Run echo PATH
PATH
It
display a line of text on standard
output.
So run echo $PATH
This time it show the path environment variable that keep
tracks certain directories of linux.
So hopefully remember cat shows the content of the file.
cat mytextfile
there is a single line in a “mytextfile”.
So you can add a new line to this file with the echo
command. So run echo command type your text double greater then sign after file
name - echo “a newline” >>mytextfile
After it see the content of the file with cat command cat
mytextfile and here is line is added in the file.
Also we show in te cat command the single greater then
symbol overwrites the entire content with the new line, just remember that-
Echo “a newline”
>mytextfile
Cat mytextfile
So as you see all content of the file is overwritten with a
line.
Echo command is used to declare the value of variable and
echo it value. For example declare a variable of x and assign its value =10
X=10
Lets echo its value. Run command echo thevalue of variable x
= $x
The value of x =10
Using option \n backspace with backslash interpretor –e
treats new line from where is used
Echo –e “gateway \nis \na \ncomputer \ntranning \ninstitute”
Using option \t horizontal tab with backslash interpretor –e treats to have
horizontal tab space
Echo –e “gateway \tis \na \tcomputer \ttranning \tinstitute
Using option \v vertical tab with backslash interpretor –e treats to have
vetical tab space
Echo –e “gateway \vis \va \vcomputer \vtranning \vinstitute
echo command bash,
echo command in batch file,
echo command in dockerfile,
echo command in dos,
echo command in git bas,
echo command in hindi,
echo command in linux in hindi,
echo command in linux in hindi,
echo command in linux javatpoint,
echo command in linux meaning,
echo command in linux options,
echo command in linux script,
echo command in linux to scan disk,
echo command in mac,
echo command in selenium ide,
echo command in unix,
echo command in windows,
echo command not found,
echo command output to file,
echo command,