使用 rsync 将文件从远程服务器复制到本地机器 [英] Copying files using rsync from remote server to local machine

查看:98
本文介绍了使用 rsync 将文件从远程服务器复制到本地机器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一旦我通过 ssh 连接到我的远程服务器,将所有文件从一个目录复制到我机器上的本地目录的命令是什么?

Once I've ssh'd into my remote server, what would the command be to copy all files from a directory to a local directory on my machine?

推荐答案

来自本地机器:

rsync -chavzP --stats user@remote.host:/path/to/copy /path/to/local/storage

从具有非标准 ssh 端口的本地计算机:

From your local machine with a non standard ssh port:

rsync -chavzP -e "ssh -p $portNumber" user@remote.host:/path/to/copy /local/path

或者来自远程主机,假设您真的想以这种方式工作并且您的本地机器正在侦听 SSH:

Or from the remote host, assuming you really want to work this way and your local machine is listening on SSH:

rsync -chavzP --stats /path/to/copy user@host.remoted.from:/path/to/local/storage

参见 man rsync 解释我常用的开关.

See man rsync for an explanation of my usual switches.

这篇关于使用 rsync 将文件从远程服务器复制到本地机器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆