如何使用SSH和MAC OS X终端在计算机之间复制文件 [英] How to copy files across computers using SSH and MAC OS X Terminal

查看:252
本文介绍了如何使用SSH和MAC OS X终端在计算机之间复制文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将.profile,.rvm和.ssh文件夹/文件复制到新计算机上,并不断收到非常规文件"响应.我知道如何使用cpssh命令,但是我不确定如何使用它们来将文件从一台计算机传输到另一台计算机.

I'm trying to copy my .profile, .rvm and .ssh folders/files to a new computer and keep getting a "not a regular file" response. I know how to use the cp and ssh commands but I'm not sure how to use them in order to transfer files from one computer to another.

任何帮助都会很棒,谢谢!

Any help would be great, thanks!

推荐答案

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

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

这篇关于如何使用SSH和MAC OS X终端在计算机之间复制文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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