每天一个Linux命令(63)scp命令
scp(secure copy)用于进行远程文件拷贝。
(1)用法:
用法: scp [参数] [源文件] [目标文件]
(2)功能:
功能: scp在主机间复制文件,他使用 ssh(1)作为数据传输,而且用同样认证和安全性。两个远程登录的服务器间的文件复制是允许的。
(3)选项参数:
1) -r 递归的复制整个文件夹
2) -p 保留文件的最后修改时间,最后访问时间和权限模式;
(4)实例:
1)root@Unbuntu:/home/sunjimeng/桌面# rcp sunmeng@CentOS:/home/sunmeng/rcptext ./ 将远程文件复制到本地
root@Unbuntu:/home/sunjimeng/桌面# ll
总用量
drwxr-xr-x sunjimeng sunjimeng 6月 : ./
drwxr-xr-x sunjimeng sunjimeng 6月 : ../
root@Unbuntu:/home/sunjimeng/桌面# rcp sunmeng@CentOS:/home/sunmeng/rcptext ./
root@Unbuntu:/home/sunjimeng/桌面# ll
总用量
drwxr-xr-x sunjimeng sunjimeng 6月 : ./
drwxr-xr-x sunjimeng sunjimeng 6月 : ../
-rw-r--r-- root root 6月 : rcptext
2)root@Unbuntu:/home/sunjimeng/桌面# rcp -r sunmeng@CentOS:/home/sunmeng/Documents ./ 复制远程文件到本地
root@Unbuntu:/home/sunjimeng/桌面# rcp sunmeng@CentOS:/home/sunmeng/Documents ./
rcp: /home/sunmeng/Documents: not a plain file
root@Unbuntu:/home/sunjimeng/桌面# rcp -r sunmeng@CentOS:/home/sunmeng/Documents ./
root@Unbuntu:/home/sunjimeng/桌面# ll
总用量
drwxr-xr-x sunjimeng sunjimeng 6月 : ./
drwxr-xr-x sunjimeng sunjimeng 6月 : ../
drwxr-xr-x root root 6月 : Documents/
-rw-r--r-- root root 6月 : rcptext
3)将远程文件复制到本地
CentOS:
[root@localhost Documents]# ll
总用量
-rw-r--r--. root root 6月 : text1.txt
-rw-r--r--. root root 6月 : text2.txt
Unbuntu:
root@Unbuntu:/home/sunjimeng/桌面# ll
总用量
drwxr-xr-x sunjimeng sunjimeng 6月 : ./
drwxr-xr-x sunjimeng sunjimeng 6月 : ../
root@Unbuntu:/home/sunjimeng/桌面# touch Unbuntu.txt
root@Unbuntu:/home/sunjimeng/桌面# rcp ./Unbuntu.txt sunmeng@CentOS:/home/sunmeng/Documents/
CentOS:
[root@localhost Documents]# ll
总用量
-rw-r--r--. root root 6月 : text1.txt
-rw-r--r--. root root 6月 : text2.txt
-rw-r--r-- sunmeng sunmeng 6月 : Unbuntu.txt
4)[root@localhost Documents]# rcp -p text2.txt root@Unbuntu:/home/sunjimeng/桌面 复制文件时保留原文件的属性
CentOS:
[root@localhost Documents]# ll
总用量
-rw-r--r--. root root 6月 : text1.txt
-rw-r--r--. root root 6月 : text2.txt
[root@localhost Documents]# rcp text1.txt root@Unbuntu:/home/sunjimeng/桌面
[root@localhost Documents]# rcp -p text2.txt root@Unbuntu:/home/sunjimeng/桌面
Unbuntu:
root@Unbuntu:/home/sunjimeng/桌面# ll
总用量
drwxr-xr-x sunjimeng sunjimeng 6月 : ./
drwxr-xr-x sunjimeng sunjimeng 6月 : ../
-rw-r--r-- root root 6月 30 : text1.txt
-rw-r--r-- root root 6月 27 : text2.txt
(5)其他:
rcp余scp的区别:
rcp通过rsh方式远端复制文件或目录;scp通过ssh方式远端复制文件或目录。
rcp是一种不安全的的传输文件的方式,scp则比较安全,但有可能scp命令执行时需要用户输入密码和口令。
linux下不同服务器间数据传输命令和工具:rcp,scp,rsync,ftp,sftp,lftp,wget,curl。(http://blog.csdn.net/emili/article/details/6858818)
每天一个Linux命令(63)scp命令的更多相关文章
- 【转】linux之cp/scp命令+scp命令详解
linux之cp/scp命令+scp命令详解 名称:cp 使用权限:所有使用者 使用方式: cp [options] source dest cp [options] source... dire ...
- Linux 命令之 scp 命令详解
Linux 命令之 scp 命令详解 一.scp 简介 scp 命令用于不同主机之间复制文件和目录. scp 是 secure copy 的缩写,是 基于 ssh 协议进行安全的远程文件拷贝命令. s ...
- 在 Linux 下使用 scp 命令
将文件或文件夹从网络上的一个主机拷贝到另一个主机当中去. here:在 Linux 下使用 scp 命令 摘要: scp 是安全拷贝协议(Secure Copy Protocol)的缩写, scp 是 ...
- 在linux上使用"scp"命令拷贝一个目录到另一台服务器的时候报"not a regular file"错误的解决办法
今天在linux命令行使用scp命令拷贝一个目录到另一台服务器的时候,报如下错误: [root@hadoop01 ~]# scp flume -r hadoop02:/root/apps flume: ...
- 每天一个linux命令(47)--scp命令
scp是secure copy 的简写,用于在Linux 下进行远程拷贝文件的命令,和它类似的命令有cp,不过cp只是在本机进行拷贝而不能跨服务器,而且scp传输是加密的.可能会稍微影响一下速度.当 ...
- 每天一个linux命令:scp命令
scp是secure copy的简写,用于在Linux下进行远程拷贝文件的命令,和它类似的命令有cp,不过cp只是在本机进行拷贝不能跨服务器,而且scp传输是加密的.可能会稍微影响一下速度.当你服务器 ...
- linux之cp/scp命令+scp命令详解
名称:cp 使用权限:所有使用者 使用方式: cp [options] source dest cp [options] source... directory 说明:将一个档案拷贝至另一档案,或将数 ...
- Linux学习之三--scp命令
scp是secure copy的简写,用于在Linux下进行远程拷贝文件的命令,和它类似的命令有cp,不过cp只是在本机进行拷贝不能跨服务器,而且scp传输是加密的.可能会稍微影响一下速度.当你服务器 ...
- linux之cp/scp命令+scp命令详解(转)
名称:cp 使用权限:所有使用者 使用方式: cp [options] source dest cp [options] source... directory 说明:将一个档案拷贝至另一档案,或将数 ...
- Linux学习之scp命令
scp是secure copy的简写,用于在Linux下进行远程拷贝文件的命令,和它类似的命令有cp,不过cp只是在本机进行拷贝不能跨服务器,而且scp传输是加密的,可能会稍微影响一下速度.当你服务器 ...
随机推荐
- IPBX和话机对接
某厂家的话机和IPBX进行对接问题: 1. 该话机作为主叫方,呼叫能够正常建立 2. 该话机作为被叫方.呼叫无法建立,IPBX发送INVITE消息给该话机,该话机回复400 具体消 ...
- latex math
scalar -> lower case lettervector -> lower case bold lettermatrix -> upper case bold letter
- 【Mac安装,ATX基于uiautomator2】之安装步骤
Mac系统下安装uiaotumator2: 参考网址:<uiautomator2>以及参考github官方文档 注意:下面有坑,如果你没有下面的问题请直接跳转到 1.安装uiaotumat ...
- Java基础08 继承(转载)
继承(inheritance)是面向对象的重要概念.继承是除组合(composition)之外,提高代码重复可用性(reusibility)的另一种重要方式.组合是重复调用对象的功能接口.继承可以重复 ...
- VS2005 Manifest 配置问题总结
一.问题 编译某个遗留工程后,运行程序时报错,“由于应用程序的配置不正确,应用程序无法启动.重新安装应用程序可能会解决这个问题.” 查看生成的Manifest文件如下: <?xml versio ...
- JAVA的protected权限
1.派生类能够訪问父类的protected数据.这是毫无疑问的. 2.今天做Think in java的习题发现,同一个包内的一个类调用还有一个类的protected数据是能够的.代码例如以下: pa ...
- android 微信朋友分享,朋友圈分享
android 微信朋友分享,朋友圈分享 包名必须写成 com.weixin WXEntryActivity package com.weixin.wxapi; import android.app ...
- CentOS 7.0 防火墙
CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙.firewall:systemctl start firewalld.service#启动firewalls ...
- C#安装,启动,停止,卸载Windows服务
public class OptionServices { //安装服务 public static void InstallService(string filep ...
- POJ1182食物链(并查集经典好题)
题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=66964#problem/E 题目思路:主要有两种思路:1.带权并查集2.挑战程 ...