当前位置:首页 > 芯闻号 > 充电吧
[导读]scp 可以在 2个 linux 主机间复制文件; 1从本地复制到远程 1.1复制文件 scp local_file remote_username@remote_ip:

scp 可以在 2个 linux 主机间复制文件;
1从本地复制到远程
1.1复制文件
scp local_file remote_username@remote_ip:remote_folder
例如:scp test.c root@192.168.1.2:/tmp
拷贝我当前目录下的test.c到IP为192.168.1.2的主机上,目录为/tmp
1.2复制目录
scp -r local_folder remote_username@remote_ip:remote_folder
例如:scp -r test root@192.168.1.2:/tmp
拷贝我当前目录下的test目录到IP为192.168.1.2的主机上,目录为/tmp

2从远程复制到本地
从远程复制到本地,只要将从本地复制到远程的命令的后2个参数调换顺序即可;
2.1复制文件
scp remote_username@remote_ip:remote_folder/remote_file local_folder
例如:scp root@192.168.1.2:/tmp/test.c .
把IP为192.168.1.2的/tmp目录下的test.c文件拷贝到当前目录下
2.2复制目录
scp -r remote_username@remote_ip:remote_folder local_folder
例如:scp -r root@192.168.1.2:/tmp/test .
把IP为192.168.1.2的/tmp目录下的test目录拷贝到当前目录下

参考文章:
http://www.cnblogs.com/hitwtx/archive/2011/11/16/2251254.html

本站声明: 本文章由作者或相关机构授权发布,目的在于传递更多信息,并不代表本站赞同其观点,本站亦不保证或承诺内容真实性等。需要转载请联系该专栏作者,如若文章内容侵犯您的权益,请及时联系本站删除( 邮箱:macysun@21ic.com )。
换一批
延伸阅读
关闭