Skip to content

Linux远程执行命令

直接发送命令,多条使用分号分隔

shell
ssh {username}@{remote_node} "cd /home ; ls"

创建脚本发送命令

需要提前配置06.Linux免密访问配置.md

shell
vi remote_shell.sh

#!/bin/bash
ssh {username}@{remote_node} > /dev/null 2>&1 << eeooff
cd /home
touch abcdefg.txt
exit
eeooff
echo done!

Released under the MIT License.