【英文】SSH远程执行命令

Preface

SSH remote execution command

Execute a command

<command>: A command

1
ssh root@<ip> "<command>"

Execute a command with variables

1
ssh root@<ip> bash -c "<command>"

Execute a script file

  • Create a script file locally and execute it remotely

<filename>.sh: Script file

1
ssh root@<ip> < <filename>.sh

Done

References

Cnblogs - Younger Brother Yang