使用 rsync 将文件从远程服务器复制到本地机器

编程入门 行业动态 更新时间:2024-10-26 06:31:48
本文介绍了使用 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 将文件从远程服务器复制到本地机器

本文发布于:2023-10-17 02:54:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1499563.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:机器   服务器   文件   rsync

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!