How to run command in remote server over SSH

This article explains the way to execute commands in remote server using SSH.

#ssh USER@HOST COMMAND

Where USER, HOST and COMMAND need to be replaced with appropriate values.

If multiple commands need to be executed, they can be separated by semicolon.

#ssh USER@HOST COMMAND1; COMMAND2

Where USER, HOST, COMMAND1 and COMMAND2 need to be replaced with appropriate values.

For executing script located in the remote server,

#ssh USER@HOST sh SCRIPT-PATH

Where USER, HOST and SCRIPT-PATH need to be replaced with appropriate values.

For executing script located in the local server,

#ssh USER@HOST < SCRIPT-PATH

Where USER, HOST and SCRIPT-PATH need to be replaced with appropriate values.

That's all…