Linux echo command

One of the most useful commands in a Linux environment is echo. With it, you can provide output to the console and also test to see what your other commands will expand to if you’re using brace expansions. It can also be used to check system variables and more. In this tutorial, we will cover the basic usage of the Linux echo command.

Basic echo usage

echo Some text here
echo "Some text here"

Outputting a system variable

var='this is a variable'
echo $var
echo $USER

Output with interpretation of special characters

echo -e "This is the first line \n This is the second line \n This is the third line

Output a command before executing it

If you wish to know what your command will run you can first echo it, for example, if we change all .txt files to .pdf with mv we can use echo to see the input first

echo mv files.{txt,pdf}
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Linux tar Command

The Linux tar command is used to compress and extract files to and from an archive. In this...

Linux top command

If you wish to monitor the performance of your VPS or Dedicated server and track processes, RAM...

Linux ping command

If you wish to test your connection to a server from your Linux system you can use the Linux ping...

Linux file command

The file command is used to check a file’s type and contents in Linux environment. It is most...

Linux export command

When you’re managing your shell’s variables and you wish to save them to your environment you can...