SSH echo command

One of the most useful commands in a Linux environment is echo. With it, you can provide output to the SSH 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 SSH echo command with examples.

Basic echo usage with SSH

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 with SSH

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 Utilisateurs l'ont trouvée utile
Cette réponse était-elle pertinente?

Articles connexes

Linux tar Command

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

How to Install WordPress via SSH

Since WordPress is the most widely used CMS it’s installation process has been made as simple and...

SSH Execute Command on a Remote server

Via SSH you can connect to a remote server’s shell. This will allow you to execute commands on...

How to connect to your shared hosting account via SFTP with FileZilla

SFTP is a convenient way to use SSH, while also using the interface of a simple FTP. In order to...

SSH netstat command

If you wish to debug or track statistics of your network in a Linux environment you can use SSH...