Menu Close

How to execute a command(s) or a script via SSH

Did you know you can just send a command and receive its output with ssh?

ssh [email protected] 'uptime'

you can also script for multiple commands do:

ssh [email protected] << EOF
COMMAND1
COMMAND2
COMMAND3
EOF

so simple right? it also supports running a script.

ssh [email protected] 'bash -s' < myscript.sh

Use this now to your deployment or automation tasks! 😀

Leave a Reply

Your email address will not be published. Required fields are marked *