echo's Examples

This command is used to display a text or a string to the standard output or a file. $ echo “This is an article on basic linux commands”

$ echo –e “This is an article is for beginners. \nIt is on basic linux commands

echo prints the arguments to the screen

$ echo hello world

displays the value of variable using echo command

echo the value of variable var is $ 100

we can suppress the last line using the -n option

echo hello world hello world
echo -n hello world

we can add new line to the existing file using echo command

echo hai everyone>>colors,txt

shows all the files in a directory

echo *

prints only the .txt files

echo *txt

we can delete the contents of the file1 without deleting the file1

echo > file1

by giving \n option we can print each word in differnet line

echo -e 'hello \n world \nhai \neveryone

it gives the horizontal tab between two words

echo 'hello \t world'

it gives the vertical space

echo -e 'hai \v everyone \v hai \v friends'

DevOpsSchool
Typically replies within an hour

DevOpsSchool
Hi there 👋

How can I help you?
×
Chat with Us