zoukankan      html  css  js  c++  java
  • Linux scp命令详解

         scp是secure copy的简写,用于在Linux下进行远程拷贝文件的命令, scp传输是加密的,可能会稍微影响一下速度。另外,scp还非常不占资源,不会提高多少系统负荷,在这一点上,rsync就远远不及它了。虽然 rsync比scp会快一点,但当小文件众多的情况下,rsync会导致硬盘I/O非常高,而scp基本不影响系统正常使用

    常见命令参数

    usage: scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
               [-l limit] [-o ssh_option] [-P port] [-S program]
               [[user@]host1:]file1 ... [[user@]host2:]file2
    
    -q:  quiet
    -r:   recuersive
    -p:   properity
    -v:   verbose
    -i:   identity_file      【从指定文件中读取传输时使用的密钥文件,此参数直接传递给ssh】 
    -P:  port
    

    常见命令展示

    scp命令的实际应用概述: 

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

    (1) 复制文件: 

    命令格式:

    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  

    第1,2个指定了用户名,命令执行后需要输入用户密码,第1个仅指定了远程的目录,文件名字不变,第2个指定了文件名  

    第3,4个没有指定用户名,命令执行后需要输入用户名和密码,第3个仅指定了远程的目录,文件名字不变,第4个指定了文件名  

    (2) 复制目录: 

    命令格式:

    scp -r local_folder remote_username@remote_ip:remote_folder  

    或者

    scp -r local_folder remote_ip:remote_folder  

    第1个指定了用户名,命令执行后需要输入用户密码;  

    第2个没有指定用户名,命令执行后需要输入用户名和密码

  • 相关阅读:
    产品流程关键点分析
    Hadoop分布式文件系统(HDFS)设计
    什么是产品经理
    转:互联网产品开发流程
    如何用PHP/MySQL为 iOS App 写一个简单的web服务器(译) PART1
    mobile app 与server通信的四种方式
    Android: Client-Server communication
    Android: Client-Server communication by JSON
    Samba 源码解析之SMBclient命令流
    Samba 源码解析之内存管理
  • 原文地址:https://www.cnblogs.com/ftl1012/p/scp.html
Copyright © 2011-2022 走看看