zoukankan      html  css  js  c++  java
  • Linux ->> scp命令复制对端机器上的文件/文件夹

    scp是secure copy的简写,用于在Linux下从远程机器拷贝文件。

    特点:

    传输是加密的,稍微影响了一下速度。而相比较rsync,它对于资源的占用还是有优势的。

    用法

    scp [参数] [原路径] [目标路径]

    参数

    -C  压缩

    -p 保留原文件的修改时间,访问时间和访问权限。  

    -q  不显示传输进度条。  

    -r  递归复制整个目录。  

    -v 详细方式显示输出。scp和ssh(1)会显示出整个过程的调试信息。这些信息用于调试连接,验证和配置问题。  

    -l limit

    -P 指定传输端口

    例子:

    从本地复制文件到远端机器:  

    命令格式:  

    scp local_file remote_username@remote_ip:remote_folder  

    或者  

    scp local_file remote_username@remote_ip:remote_file  

    或者  

    scp local_file remote_ip:remote_folder  

    或者  

    scp local_file remote_ip:remote_file  

    从本地复制目录到远端机器: 

    命令格式:  

    scp -r local_folder remote_username@remote_ip:remote_folder  

    或者  

    scp -r local_folder remote_ip:remote_folder  

    从远程机器复制目录到本地服务器:

    scp root@192.168.120.204:/opt/soft/nginx-0.5.38.tar.gz /opt/soft/

    jerry@ubuntu:/run/network$ scp jerry@192.168.2.100:/home/jerry/Download/jdk-8u65-linux-x64.tar.gz ~
    The authenticity of host '192.168.2.100 (192.168.2.100)' can't be established.
    ECDSA key fingerprint is da:b7:c3:2a:ea:a2:76:4c:c3:c1:68:ca:0e:c2:ea:92.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added '192.168.2.100' (ECDSA) to the list of known hosts.
    jerry@192.168.2.100's password: 
    scp: /home/jerry/Download/jdk-8u65-linux-x64.tar.gz: No such file or directory
    jerry@ubuntu:/run/network$ scp jerry@192.168.2.100:/home/jerry/Downloads/jdk-8u65-linux-x64.tar.gz ~
    jerry@192.168.2.100's password: 
    jdk-8u65-linux-x64.tar.gz                     100%  173MB  21.6MB/s   00:08    
    jerry@ubuntu:/run/network$ 

    参考:

    每天一个linux命令(60):scp命令

  • 相关阅读:
    oracle乱码问题
    fopen 參数具体解释
    图像特征提取方法:Bag-of-words
    事务应用-运行多条SQL语句
    八大排序算法总结
    svn经常使用命令具体解释(非常全,非常有用)
    android layout属性介绍
    ubuntu/linux mint 创建proc文件的三种方法(四)
    在归档模式下删除非系统文件的恢复
    解决使用DevExpress开发错误:未将对象引用设置到对象的实例
  • 原文地址:https://www.cnblogs.com/jenrrychen/p/5081125.html
Copyright © 2011-2022 走看看