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命令

  • 相关阅读:
    Jupyter notebook中的Cell and Line Magics
    numpy中array数组对象的储存方式(n,1)和(n,)的区别
    机器学习中的标准化方法(Normalization Methods)
    matplotlib添加子图(拼图功能)
    matplotlib.pyplot.plot详解
    一行代码让你的python运行速度提高100倍
    一个简单的Shell脚本(解决windows上文本在macos上乱码问题)
    解决Mac上打开txt文件乱码问题
    LaTeX中常用代码段snippets(持续更新)
    LaTeX实时预览中文
  • 原文地址:https://www.cnblogs.com/jenrrychen/p/5081125.html
Copyright © 2011-2022 走看看