登录服务器并将输出保存在我的家中

登录服务器并将输出保存在我的家中

我想连接到我的服务器

ssh [email protected]

然后到它的节点

ssh [email protected]

然后

cat /var/log/test

我想将此输出保存在我的主目录中。

我尝试在谷歌中搜索,但找不到有用的东西。我如何使用 bash 脚本来做到这一点?

答案1

您可以通过在远程计算机上运行该命令并将其输出重定向到文件来完成此操作。例如:

ssh remote_host "ls" > /home/youruserhomefolder/file_on_local_host.txt

相关内容