如何使用 SSH 和 MAC OS X 终端在计算机之间复制文件

发布于 2024-09-19 10:55:34 字数 1550 浏览 3 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

獨角戲 2024-09-26 10:55:34

您可以使用 scp 命令来执行此操作,该命令使用 ssh 协议跨计算机复制文件。它扩展了 cp 的语法以允许引用其他系统:

scp username1@hostname1:/path/to/file username2@hostname2:/path/to/other/file

将某些内容从本机复制到其他计算机:

scp /path/to/local/file username@hostname:/path/to/remote/file

将某些内容从另一台计算机复制到本机:

scp username@hostname:/path/to/remote/file /path/to/local/file

使用指定的端口号进行复制:

scp -P 1234 username@hostname:/path/to/remote/file /path/to/local/file

You can do this with the scp command, which uses the ssh protocol to copy files across machines. It extends the syntax of cp to allow references to other systems:

scp username1@hostname1:/path/to/file username2@hostname2:/path/to/other/file

Copy something from this machine to some other machine:

scp /path/to/local/file username@hostname:/path/to/remote/file

Copy something from another machine to this machine:

scp username@hostname:/path/to/remote/file /path/to/local/file

Copy with a port number specified:

scp -P 1234 username@hostname:/path/to/remote/file /path/to/local/file
灰色世界里的红玫瑰 2024-09-26 10:55:34

首先压缩或 gzip 文件夹:
使用以下命令:

zip -r NameYouWantForZipFile.zip 文件夹到zip/

tar -pvczf BackUpDirectory.tar.gz /路径/到/目录

gzip 压缩使用 SCP 的目录:

scp [电子邮件受保护]:~/serverpath/public_html ~/桌面

First zip or gzip the folders:
Use the following command:

zip -r NameYouWantForZipFile.zip foldertozip/

or

tar -pvczf BackUpDirectory.tar.gz /path/to/directory

for gzip compression use SCP:

scp [email protected]:~/serverpath/public_html ~/Desktop

嘿看小鸭子会跑 2024-09-26 10:55:34

如果您正在处理大量文件,您可能还需要查看 rsync。

如果您要进行大量更改并希望保持目录和文件同步,您可能需要使用版本控制系统,例如 Subversion 或 Git。请参阅 http://xoa.petdance.com/How_to:_Keep_your_home_directory_in_Subversion

You may also want to look at rsync if you're doing a lot of files.

If you're going to making a lot of changes and want to keep your directories and files in sync, you may want to use a version control system like Subversion or Git. See http://xoa.petdance.com/How_to:_Keep_your_home_directory_in_Subversion

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文