健全 發表於 2019-9-3 20:49:00

两台linux服务器相互拷贝文件的两个方法

<p>  scp是secure&nbsp;copy的简写,用于在Linux下进行远程拷贝文件的命令,和它类似的命令有cp,不过cp只是在本机进行拷贝不能跨服务器,而且scp传输是加密的。可能会稍微影响一下速度。当你服务器硬盘变为只读&nbsp;read&nbsp;only&nbsp;system时,用scp可以帮你把文件移出来。另外,scp还非常不占资源,不会提高多少系统负荷,在这一点上,rsync就远远不及它了。虽然&nbsp;rsync比scp会快一点,但当小文件众多的情况下,rsync会导致硬盘I/O非常高,而scp基本不影响系统正常使用。</p>
<p>1.命令格式:</p>
<p>scp&nbsp;[参数]&nbsp;[原路径]&nbsp;[目标路径]</p>
<p>2.命令功能:</p>
<p>scp是&nbsp;secure&nbsp;copy的缩写,&nbsp;scp是linux系统下基于ssh登陆进行安全的远程文件拷贝命令。linux的scp命令可以在linux服务器之间复制文件和目录。</p>
<p>3.命令参数:</p>
<p>-1&nbsp;&nbsp;强制scp命令使用协议ssh1&nbsp;&nbsp;</p>
<p>-2&nbsp;&nbsp;强制scp命令使用协议ssh2&nbsp;&nbsp;</p>
<p>-4&nbsp;&nbsp;强制scp命令只使用IPv4寻址&nbsp;&nbsp;</p>
<p>-6&nbsp;&nbsp;强制scp命令只使用IPv6寻址&nbsp;&nbsp;</p>
<p>-B&nbsp;&nbsp;使用批处理模式(传输过程中不询问传输口令或短语)&nbsp;&nbsp;</p>
<p>-C&nbsp;&nbsp;允许压缩。(将-C标志传递给ssh,从而打开压缩功能)&nbsp;&nbsp;</p>
<p>-p&nbsp;保留原文件的修改时间,访问时间和访问权限。&nbsp;&nbsp;</p>
<p>-q&nbsp;&nbsp;不显示传输进度条。&nbsp;&nbsp;</p>
<p>-r&nbsp;&nbsp;递归复制整个目录。&nbsp;&nbsp;</p>
<p>-v&nbsp;详细方式显示输出。scp和ssh(1)会显示出整个过程的调试信息。这些信息用于调试连接,验证和配置问题。&nbsp;&nbsp;&nbsp;</p>
<p>-c&nbsp;cipher&nbsp;&nbsp;以cipher将数据传输进行加密,这个选项将直接传递给ssh。&nbsp;&nbsp;&nbsp;</p>
<p>-F&nbsp;ssh_config&nbsp;&nbsp;指定一个替代的ssh配置文件,此参数直接传递给ssh。&nbsp;&nbsp;</p>
<p>-i&nbsp;identity_file&nbsp;&nbsp;从指定文件中读取传输时使用的密钥文件,此参数直接传递给ssh。&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p>-l&nbsp;limit&nbsp;&nbsp;限定用户所能使用的带宽,以Kbit/s为单位。&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p>-o&nbsp;ssh_option&nbsp;&nbsp;如果习惯于使用ssh_config(5)中的参数传递方式,&nbsp;&nbsp;&nbsp;</p>
<p>-P&nbsp;port&nbsp;&nbsp;注意是大写的P,&nbsp;port是指定数据传输用到的端口号&nbsp;&nbsp;&nbsp;</p>
<p>-S&nbsp;program&nbsp;&nbsp;指定加密传输时所使用的程序。此程序必须能够理解ssh(1)的选项。</p>
<p>4.使用实例:</p>
<p>scp命令的实际应用概述:&nbsp;&nbsp;</p>
<p>从本地服务器复制到远程服务器:&nbsp;</p>
<p>(1)&nbsp;复制文件:&nbsp;&nbsp;</p>
<p>命令格式:&nbsp;&nbsp;</p>
<p>scp&nbsp;local_file&nbsp;remote_username@remote_ip:remote_folder&nbsp;&nbsp;</p>
<p>或者&nbsp;&nbsp;</p>
<p>scp&nbsp;local_file&nbsp;remote_username@remote_ip:remote_file&nbsp;&nbsp;</p>
<p>或者&nbsp;&nbsp;</p>
<p>scp&nbsp;local_file&nbsp;remote_ip:remote_folder&nbsp;&nbsp;</p>
<p>或者&nbsp;&nbsp;</p>
<p>scp&nbsp;local_file&nbsp;remote_ip:remote_file&nbsp;&nbsp;</p>
<p>第1,2个指定了用户名,命令执行后需要输入用户密码,第1个仅指定了远程的目录,文件名字不变,第2个指定了文件名&nbsp;&nbsp;</p>
<p>第3,4个没有指定用户名,命令执行后需要输入用户名和密码,第3个仅指定了远程的目录,文件名字不变,第4个指定了文件名&nbsp;&nbsp;&nbsp;</p>
<p>(2)&nbsp;复制目录:&nbsp;&nbsp;</p>
<p>命令格式:&nbsp;&nbsp;</p>
<p>scp&nbsp;-r&nbsp;local_folder&nbsp;remote_username@remote_ip:remote_folder&nbsp;&nbsp;</p>
<p>或者&nbsp;&nbsp;</p>
<p>scp&nbsp;-r&nbsp;local_folder&nbsp;remote_ip:remote_folder&nbsp;&nbsp;</p>
<p>第1个指定了用户名,命令执行后需要输入用户密码;&nbsp;&nbsp;</p>
<p>第2个没有指定用户名,命令执行后需要输入用户名和密码;</p>
<p>&nbsp;&nbsp;</p>
<p>从远程服务器复制到本地服务器:&nbsp;</p>
<p>从远程复制到本地的scp命令与上面的命令雷同,只要将从本地复制到远程的命令后面2个参数互换顺序就行了。</p>
<p>实例1:从远处复制文件到本地目录</p>
<p>命令:</p>
<p>scp&nbsp;root@192.168.120.204:/opt/soft/nginx-0.5.38.tar.gz&nbsp;/opt/soft/</p>
<p>输出:</p>
<p>&nbsp;</p>
<div class="prettyprint lang-bsh">
<div>bsh代码</div>
</div>
<div class="cnblogs_code">
<pre># cd /opt/soft/<span style="color: rgba(0, 0, 0, 1)">
# ll
总计 </span><span style="color: rgba(128, 0, 128, 1)">80072</span><span style="color: rgba(0, 0, 0, 1)">
drwxr</span>-xr-x <span style="color: rgba(128, 0, 128, 1)">12</span> root root   <span style="color: rgba(128, 0, 128, 1)">4096</span> <span style="color: rgba(128, 0, 128, 1)">09</span>-<span style="color: rgba(128, 0, 128, 1)">21</span> <span style="color: rgba(128, 0, 128, 1)">18</span>:<span style="color: rgba(128, 0, 128, 1)">40</span> fms3.<span style="color: rgba(128, 0, 128, 1)">5</span><span style="color: rgba(0, 0, 0, 1)">
drwxr</span>-xr-x<span style="color: rgba(128, 0, 128, 1)">3</span> root root   <span style="color: rgba(128, 0, 128, 1)">4096</span> <span style="color: rgba(128, 0, 128, 1)">09</span>-<span style="color: rgba(128, 0, 128, 1)">21</span> <span style="color: rgba(128, 0, 128, 1)">17</span>:<span style="color: rgba(128, 0, 128, 1)">58</span> fms4.<span style="color: rgba(128, 0, 128, 1)">5</span><span style="color: rgba(0, 0, 0, 1)">
drwxr</span>-xr-x <span style="color: rgba(128, 0, 128, 1)">10</span> root root   <span style="color: rgba(128, 0, 128, 1)">4096</span> <span style="color: rgba(128, 0, 128, 1)">10</span>-<span style="color: rgba(128, 0, 128, 1)">30</span> <span style="color: rgba(128, 0, 128, 1)">17</span>:<span style="color: rgba(128, 0, 128, 1)">15</span> jdk1.<span style="color: rgba(128, 0, 128, 1)">6</span><span style="color: rgba(0, 0, 0, 1)">.0_16
drwxr</span>-xr-x <span style="color: rgba(128, 0, 128, 1)">10</span> root root   <span style="color: rgba(128, 0, 128, 1)">4096</span> <span style="color: rgba(128, 0, 128, 1)">09</span>-<span style="color: rgba(128, 0, 128, 1)">17</span> <span style="color: rgba(128, 0, 128, 1)">19</span>:<span style="color: rgba(128, 0, 128, 1)">27</span> jdk1.<span style="color: rgba(128, 0, 128, 1)">6</span><span style="color: rgba(0, 0, 0, 1)">.0_16.bak
</span>-rwxr-xr-x<span style="color: rgba(128, 0, 128, 1)">1</span> root root <span style="color: rgba(128, 0, 128, 1)">81871260</span> <span style="color: rgba(128, 0, 128, 1)">2009</span>-<span style="color: rgba(128, 0, 128, 1)">12</span>-<span style="color: rgba(128, 0, 128, 1)">21</span> jdk-6u16-linux-<span style="color: rgba(0, 0, 0, 1)">x64.bin
drwxrwxrwx</span><span style="color: rgba(128, 0, 128, 1)">2</span> root root   <span style="color: rgba(128, 0, 128, 1)">4096</span> <span style="color: rgba(128, 0, 128, 1)">09</span>-<span style="color: rgba(128, 0, 128, 1)">21</span> <span style="color: rgba(128, 0, 128, 1)">01</span>:<span style="color: rgba(128, 0, 128, 1)">16</span><span style="color: rgba(0, 0, 0, 1)"> mysql
drwxr</span>-xr-x<span style="color: rgba(128, 0, 128, 1)">3</span> root root   <span style="color: rgba(128, 0, 128, 1)">4096</span> <span style="color: rgba(128, 0, 128, 1)">09</span>-<span style="color: rgba(128, 0, 128, 1)">21</span> <span style="color: rgba(128, 0, 128, 1)">18</span>:<span style="color: rgba(128, 0, 128, 1)">40</span><span style="color: rgba(0, 0, 0, 1)"> setup_file
drwxr</span>-xr-x<span style="color: rgba(128, 0, 128, 1)">9</span> root root   <span style="color: rgba(128, 0, 128, 1)">4096</span> <span style="color: rgba(128, 0, 128, 1)">09</span>-<span style="color: rgba(128, 0, 128, 1)">17</span> <span style="color: rgba(128, 0, 128, 1)">19</span>:<span style="color: rgba(128, 0, 128, 1)">23</span> tomcat6.<span style="color: rgba(128, 0, 128, 1)">0.32</span><span style="color: rgba(0, 0, 0, 1)">
drwxr</span>-xr-x<span style="color: rgba(128, 0, 128, 1)">9</span> root root   <span style="color: rgba(128, 0, 128, 1)">4096</span> <span style="color: rgba(128, 0, 128, 1)">2012</span>-<span style="color: rgba(128, 0, 128, 1)">08</span>-<span style="color: rgba(128, 0, 128, 1)">14</span> tomcat_7.<span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">
# </span><span style="color: rgba(0, 0, 255, 1)">scp</span> root@<span style="color: rgba(128, 0, 128, 1)">192.168</span>.<span style="color: rgba(128, 0, 128, 1)">120.204</span>:/opt/soft/nginx-<span style="color: rgba(128, 0, 128, 1)">0.5</span>.<span style="color: rgba(128, 0, 128, 1)">38</span>.<span style="color: rgba(0, 0, 255, 1)">tar</span>.gz /opt/soft/<span style="color: rgba(0, 0, 0, 1)">
root@</span><span style="color: rgba(128, 0, 128, 1)">192.168</span>.<span style="color: rgba(128, 0, 128, 1)">120.204</span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">s password: </span>
nginx-<span style="color: rgba(128, 0, 128, 1)">0.5</span>.<span style="color: rgba(128, 0, 128, 1)">38</span>.<span style="color: rgba(0, 0, 255, 1)">tar</span>.gz                                                                               <span style="color: rgba(128, 0, 128, 1)">100</span>%479KB <span style="color: rgba(128, 0, 128, 1)">478</span>.7KB/s   <span style="color: rgba(128, 0, 128, 1)">00</span>:<span style="color: rgba(128, 0, 128, 1)">00</span><span style="color: rgba(0, 0, 0, 1)">   
# ll
总计 </span><span style="color: rgba(128, 0, 128, 1)">80556</span><span style="color: rgba(0, 0, 0, 1)">
drwxr</span>-xr-x <span style="color: rgba(128, 0, 128, 1)">12</span> root root   <span style="color: rgba(128, 0, 128, 1)">4096</span> <span style="color: rgba(128, 0, 128, 1)">09</span>-<span style="color: rgba(128, 0, 128, 1)">21</span> <span style="color: rgba(128, 0, 128, 1)">18</span>:<span style="color: rgba(128, 0, 128, 1)">40</span> fms3.<span style="color: rgba(128, 0, 128, 1)">5</span><span style="color: rgba(0, 0, 0, 1)">
drwxr</span>-xr-x<span style="color: rgba(128, 0, 128, 1)">3</span> root root   <span style="color: rgba(128, 0, 128, 1)">4096</span> <span style="color: rgba(128, 0, 128, 1)">09</span>-<span style="color: rgba(128, 0, 128, 1)">21</span> <span style="color: rgba(128, 0, 128, 1)">17</span>:<span style="color: rgba(128, 0, 128, 1)">58</span> fms4.<span style="color: rgba(128, 0, 128, 1)">5</span><span style="color: rgba(0, 0, 0, 1)">
drwxr</span>-xr-x <span style="color: rgba(128, 0, 128, 1)">10</span> root root   <span style="color: rgba(128, 0, 128, 1)">4096</span> <span style="color: rgba(128, 0, 128, 1)">10</span>-<span style="color: rgba(128, 0, 128, 1)">30</span> <span style="color: rgba(128, 0, 128, 1)">17</span>:<span style="color: rgba(128, 0, 128, 1)">15</span> jdk1.<span style="color: rgba(128, 0, 128, 1)">6</span><span style="color: rgba(0, 0, 0, 1)">.0_16
drwxr</span>-xr-x <span style="color: rgba(128, 0, 128, 1)">10</span> root root   <span style="color: rgba(128, 0, 128, 1)">4096</span> <span style="color: rgba(128, 0, 128, 1)">09</span>-<span style="color: rgba(128, 0, 128, 1)">17</span> <span style="color: rgba(128, 0, 128, 1)">19</span>:<span style="color: rgba(128, 0, 128, 1)">27</span> jdk1.<span style="color: rgba(128, 0, 128, 1)">6</span><span style="color: rgba(0, 0, 0, 1)">.0_16.bak
</span>-rwxr-xr-x<span style="color: rgba(128, 0, 128, 1)">1</span> root root <span style="color: rgba(128, 0, 128, 1)">81871260</span> <span style="color: rgba(128, 0, 128, 1)">2009</span>-<span style="color: rgba(128, 0, 128, 1)">12</span>-<span style="color: rgba(128, 0, 128, 1)">21</span> jdk-6u16-linux-<span style="color: rgba(0, 0, 0, 1)">x64.bin
drwxrwxrwx</span><span style="color: rgba(128, 0, 128, 1)">2</span> root root   <span style="color: rgba(128, 0, 128, 1)">4096</span> <span style="color: rgba(128, 0, 128, 1)">09</span>-<span style="color: rgba(128, 0, 128, 1)">21</span> <span style="color: rgba(128, 0, 128, 1)">01</span>:<span style="color: rgba(128, 0, 128, 1)">16</span><span style="color: rgba(0, 0, 0, 1)"> mysql
</span>-rw-r--r--<span style="color: rgba(128, 0, 128, 1)">1</span> root root   <span style="color: rgba(128, 0, 128, 1)">490220</span> <span style="color: rgba(128, 0, 128, 1)">03</span>-<span style="color: rgba(128, 0, 128, 1)">15</span> <span style="color: rgba(128, 0, 128, 1)">09</span>:<span style="color: rgba(128, 0, 128, 1)">11</span> nginx-<span style="color: rgba(128, 0, 128, 1)">0.5</span>.<span style="color: rgba(128, 0, 128, 1)">38</span>.<span style="color: rgba(0, 0, 255, 1)">tar</span><span style="color: rgba(0, 0, 0, 1)">.gz
drwxr</span>-xr-x<span style="color: rgba(128, 0, 128, 1)">3</span> root root   <span style="color: rgba(128, 0, 128, 1)">4096</span> <span style="color: rgba(128, 0, 128, 1)">09</span>-<span style="color: rgba(128, 0, 128, 1)">21</span> <span style="color: rgba(128, 0, 128, 1)">18</span>:<span style="color: rgba(128, 0, 128, 1)">40</span><span style="color: rgba(0, 0, 0, 1)"> setup_file
drwxr</span>-xr-x<span style="color: rgba(128, 0, 128, 1)">9</span> root root   <span style="color: rgba(128, 0, 128, 1)">4096</span> <span style="color: rgba(128, 0, 128, 1)">09</span>-<span style="color: rgba(128, 0, 128, 1)">17</span> <span style="color: rgba(128, 0, 128, 1)">19</span>:<span style="color: rgba(128, 0, 128, 1)">23</span> tomcat6.<span style="color: rgba(128, 0, 128, 1)">0.32</span><span style="color: rgba(0, 0, 0, 1)">
drwxr</span>-xr-x<span style="color: rgba(128, 0, 128, 1)">9</span> root root   <span style="color: rgba(128, 0, 128, 1)">4096</span> <span style="color: rgba(128, 0, 128, 1)">2012</span>-<span style="color: rgba(128, 0, 128, 1)">08</span>-<span style="color: rgba(128, 0, 128, 1)">14</span> tomcat_7.<span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">
#</span></pre>
</div>
<p>&nbsp;</p>
<p>说明:</p>
<p>从192.168.120.204机器上的/opt/soft/的目录中下载nginx-0.5.38.tar.gz&nbsp;文件到本地/opt/soft/目录中</p>
<p>实例2:从远处复制到本地</p>
<p>命令:</p>
<p>scp&nbsp;-r&nbsp;root@192.168.120.204:/opt/soft/mongodb&nbsp;/opt/soft/</p>
<p>输出:</p>
<div class="prettyprint lang-bsh">
<div>bsh代码</div>
</div>
<div class="cnblogs_Highlighter">
<pre class="brush:bash;gutter:true;"># ll
总计 80556
drwxr-xr-x 12 root root   4096 09-21 18:40 fms3.5
drwxr-xr-x3 root root   4096 09-21 17:58 fms4.5
drwxr-xr-x 10 root root   4096 10-30 17:15 jdk1.6.0_16
drwxr-xr-x 10 root root   4096 09-17 19:27 jdk1.6.0_16.bak
-rwxr-xr-x1 root root 81871260 2009-12-21 jdk-6u16-linux-x64.bin
drwxrwxrwx2 root root   4096 09-21 01:16 mysql
-rw-r--r--1 root root   490220 03-15 09:11 nginx-0.5.38.tar.gz
drwxr-xr-x3 root root   4096 09-21 18:40 setup_file
drwxr-xr-x9 root root   4096 09-17 19:23 tomcat6.0.32
drwxr-xr-x9 root root   4096 2012-08-14 tomcat_7.0
# scp -r root@192.168.120.204:/opt/soft/mongodb /opt/soft/
root@192.168.120.204's password:
mongodb-linux-i686-static-1.8.5.tgz                                                               100%   28MB28.3MB/s   00:01   
README                                                                                          100%731   0.7KB/s   00:00   
THIRD-PARTY-NOTICES                                                                               100% 7866   7.7KB/s   00:00   
mongorestore                                                                                    100% 7753KB   7.6MB/s   00:00   
mongod                                                                                          100% 7760KB   7.6MB/s   00:01   
mongoexport                                                                                       100% 7744KB   7.6MB/s   00:00   
bsondump                                                                                          100% 7737KB   7.6MB/s   00:00   
mongofiles                                                                                        100% 7748KB   7.6MB/s   00:01   
mongostat                                                                                       100% 7808KB   7.6MB/s   00:00   
mongos                                                                                          100% 5262KB   5.1MB/s   00:01   
mongo                                                                                             100% 3707KB   3.6MB/s   00:00   
mongoimport                                                                                       100% 7754KB   7.6MB/s   00:00   
mongodump                                                                                       100% 7773KB   7.6MB/s   00:00   
GNU-AGPL-3.0                                                                                    100%   34KB33.7KB/s   00:00   
# ll
总计 80560
drwxr-xr-x 12 root root   4096 09-21 18:40 fms3.5
drwxr-xr-x3 root root   4096 09-21 17:58 fms4.5
drwxr-xr-x 10 root root   4096 10-30 17:15 jdk1.6.0_16
drwxr-xr-x 10 root root   4096 09-17 19:27 jdk1.6.0_16.bak
-rwxr-xr-x1 root root 81871260 2009-12-21 jdk-6u16-linux-x64.bin
drwxr-xr-x3 root root   4096 03-15 09:18 mongodb
drwxrwxrwx2 root root   4096 09-21 01:16 mysql
-rw-r--r--1 root root   490220 03-15 09:11 nginx-0.5.38.tar.gz
drwxr-xr-x3 root root   4096 09-21 18:40 setup_file
drwxr-xr-x9 root root   4096 09-17 19:23 tomcat6.0.32
drwxr-xr-x9 root root   4096 2012-08-14 tomcat_7.0
#
</pre>
</div>
<p>  </p>
<p>说明:</p>
<p>从192.168.120.204机器上的/opt/soft/中下载mongodb&nbsp;目录到本地的/opt/soft/目录来。</p>
<p>实例3:上传本地文件到远程机器指定目录</p>
<p>命令:</p>
<p>scp&nbsp;/opt/soft/nginx-0.5.38.tar.gz&nbsp;root@192.168.120.204:/opt/soft/scptest</p>
<p>输出:</p>
<div class="prettyprint lang-bsh">
<div>bsh代码</div>
</div>
<div class="cnblogs_Highlighter">
<pre class="brush:bash;gutter:true;">上传前目标机器的目标目录:
# cd scptest/
# ll
总计 0
# ll

本地机器上传:
# scp /opt/soft/nginx-0.5.38.tar.gz root@192.168.120.204:/opt/soft/scptest
root@192.168.120.204's password:
nginx-0.5.38.tar.gz                                                                               100%479KB 478.7KB/s   00:00   
#

上传后目标机器的目标目录:
# ll
总计 484
-rw-r--r-- 1 root root 490220 03-15 09:25 nginx-0.5.38.tar.gz
#
</pre>
</div>
<p>  </p>
<p>说明:</p>
<p>复制本地opt/soft/目录下的文件nginx-0.5.38.tar.gz&nbsp;到远程机器192.168.120.204的opt/soft/scptest目录</p>
<p>实例4:上传本地目录到远程机器指定目录</p>
<p>命令:</p>
<p>scp&nbsp;-r&nbsp;/opt/soft/mongodb&nbsp;root@192.168.120.204:/opt/soft/scptest</p>
<p>输出:</p>
<div class="prettyprint lang-bsh">
<div>bsh代码</div>
</div>
<div class="cnblogs_Highlighter">
<pre class="brush:bash;gutter:true;">上传前目标机器的目标目录:
# cd /opt/soft/scptest/
# ll
总计 484
-rw-r--r-- 1 root root 490220 03-15 09:25 nginx-0.5.38.tar.gz
#
本地机器上传:
# scp -r /opt/soft/mongodb root@192.168.120.204:/opt/soft/scptest
root@192.168.120.204's password:
mongodb-linux-i686-static-1.8.5.tgz                                                               100%   28MB28.3MB/s   00:01   
README                                                                                          100%731   0.7KB/s   00:00   
THIRD-PARTY-NOTICES                                                                               100% 7866   7.7KB/s   00:00   
mongorestore                                                                                    100% 7753KB   7.6MB/s   00:00   
mongod                                                                                          100% 7760KB   7.6MB/s   00:01   
mongoexport                                                                                       100% 7744KB   7.6MB/s   00:00   
bsondump                                                                                          100% 7737KB   7.6MB/s   00:00   
mongofiles                                                                                        100% 7748KB   7.6MB/s   00:00   
mongostat                                                                                       100% 7808KB   7.6MB/s   00:01   
mongos                                                                                          100% 5262KB   5.1MB/s   00:00   
mongo                                                                                             100% 3707KB   3.6MB/s   00:00   
mongoimport                                                                                       100% 7754KB   7.6MB/s   00:01   
mongodump                                                                                       100% 7773KB   7.6MB/s   00:00   
GNU-AGPL-3.0                                                                                    100%   34KB33.7KB/s   00:00   
#

上传后目标机器的目标目录:
# ll
总计 488
drwxr-xr-x 3 root root   4096 03-15 09:33 mongodb
-rw-r--r-- 1 root root 490220 03-15 09:25 nginx-0.5.38.tar.gz
#
</pre>
</div>
<p>  </p>
<p>&nbsp;</p>
<p>说明:</p>
<p>&nbsp; &nbsp;&nbsp;上传本地目录&nbsp;/opt/soft/mongodb到远程机器192.168.120.204上/opt/soft/scptest的目录中去</p><br><br>
来源:https://www.cnblogs.com/fanblogs/p/11455554.html
頁: [1]
查看完整版本: 两台linux服务器相互拷贝文件的两个方法