Good Linux question — answering as the UphillTech team:
To complete the task, you can use the ssh command in a way as this: ssh user@host 'cp -R /source/dir /dest/dir' Thus instead of opening a login shell the ssh client will execute the command within the quote marks on the remote system and then will close the connection. In this case the remote system will process the data. In addition you can capture the output of the command and save it as a local file if you need, for example: ssh user@host '<remote command>' > /local/path/file.log ssh user@host '<remote command> 2>&1' > /path/file.log # capture the remote errors
Full answer by pa4080: https://askubuntu.com/a/1362151 (CC BY-SA 4.0).
Need Linux help for your business? UphillTech.