系統(tǒng)之家 - 系統(tǒng)光盤(pán)下載網(wǎng)站!

當(dāng)前位置:系統(tǒng)之家 > 系統(tǒng)教程 > Linux scp命令使用實(shí)例

Linux scp命令使用實(shí)例匯總(3)

時(shí)間:2014-12-30 17:31:23 作者:qipeng 來(lái)源:系統(tǒng)之家 1. 掃描二維碼隨時(shí)看資訊 2. 請(qǐng)使用手機(jī)瀏覽器訪問(wèn): https://m.xitongzhijia.net/xtjc/20141230/33769.html 手機(jī)查看 評(píng)論

  實(shí)例2:從遠(yuǎn)處復(fù)制到本地

  命令:scp -r root@192.168.120.204:/opt/soft/mongodb /opt/soft/

  輸出:

  代碼如下:

 。踨oot@localhost soft]# ll

  總計(jì) 80556

  drwxr-xr-x 12 root root 4096 09-21 18:40 fms3.5

  drwxr-xr-x 3 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-x 1 root root 81871260 2009-12-21 jdk-6u16-linux-x64.bin

  drwxrwxrwx 2 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-x 3 root root 4096 09-21 18:40 setup_file

  drwxr-xr-x 9 root root 4096 09-17 19:23 tomcat6.0.32

  drwxr-xr-x 9 root root 4096 2012-08-14 tomcat_7.0

 。踨oot@localhost soft]# scp -r 《a href=“mailto:root@192.168.120.204:/opt/soft/mongodb”》root@192.168.120.204:/opt/soft/mongodb《/a》 /opt/soft/

  《a href=“mailto:root@192.168.120.204‘s”》root@192.168.120.204’s《/a》 password:

  mongodb-linux-i686-static-1.8.5.tgz 100% 28MB 28.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% 34KB 33.7KB/s 00:00

 。踨oot@localhost soft]# ll

  總計(jì) 80560

  drwxr-xr-x 12 root root 4096 09-21 18:40 fms3.5

  drwxr-xr-x 3 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-x 1 root root 81871260 2009-12-21 jdk-6u16-linux-x64.bin

  drwxr-xr-x 3 root root 4096 03-15 09:18 mongodb

  drwxrwxrwx 2 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-x 3 root root 4096 09-21 18:40 setup_file

  drwxr-xr-x 9 root root 4096 09-17 19:23 tomcat6.0.32

  drwxr-xr-x 9 root root 4096 2012-08-14 tomcat_7.0

 。踨oot@localhost soft]#

  說(shuō)明:從192.168.120.204機(jī)器上的/opt/soft/中下載mongodb 目錄到本地的/opt/soft/目錄來(lái)。

  實(shí)例3:上傳本地文件到遠(yuǎn)程機(jī)器指定目錄

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

  輸出:

  代碼如下:

  上傳前目標(biāo)機(jī)器的目標(biāo)目錄:

 。踨oot@localhost soft]# cd scptest/

 。踨oot@localhost scptest]# ll

  總計(jì) 0

 。踨oot@localhost scptest]# ll《/p》 《p》本地機(jī)器上傳:

 。踨oot@localhost soft]# scp /opt/soft/nginx-0.5.38.tar.gz 《a href=“mailto:root@192.168.120.204:/opt/soft/scptest”》root@192.168.120.204:/opt/soft/scptest《/a》

  《a href=“mailto:root@192.168.120.204‘s”》root@192.168.120.204’s《/a》 password:

  nginx-0.5.38.tar.gz 100% 479KB 478.7KB/s 00:00

 。踨oot@localhost soft]# 《/p》 《p》上傳后目標(biāo)機(jī)器的目標(biāo)目錄:

 。踨oot@localhost scptest]# ll

  總計(jì) 484

  -rw-r--r-- 1 root root 490220 03-15 09:25 nginx-0.5.38.tar.gz

 。踨oot@localhost scptest]#

  說(shuō)明:復(fù)制本地opt/soft/目錄下的文件nginx-0.5.38.tar.gz 到遠(yuǎn)程機(jī)器192.168.120.204的opt/soft/scptest目錄

  實(shí)例4:上傳本地目錄到遠(yuǎn)程機(jī)器指定目錄

  命令:scp -r /opt/soft/mongodb root@192.168.120.204:/opt/soft/scptest

  輸出:

  代碼如下:

  上傳前目標(biāo)機(jī)器的目標(biāo)目錄:

 。踨oot@localhost ~]# cd /opt/soft/scptest/

 。踨oot@localhost scptest]# ll

  總計(jì) 484

  -rw-r--r-- 1 root root 490220 03-15 09:25 nginx-0.5.38.tar.gz

 。踨oot@localhost scptest]#

  本地機(jī)器上傳:

 。踨oot@localhost ~]# scp -r /opt/soft/mongodb 《a href=“mailto:root@192.168.120.204:/opt/soft/scptest”》root@192.168.120.204:/opt/soft/scptest《/a》

  《a href=“mailto:root@192.168.120.204‘s”》root@192.168.120.204’s《/a》 password:

  mongodb-linux-i686-static-1.8.5.tgz 100% 28MB 28.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% 34KB 33.7KB/s 00:00

 。踨oot@localhost ~]# 《/p》 《p》上傳后目標(biāo)機(jī)器的目標(biāo)目錄:

  [root@localhost scptest]# ll

  總計(jì) 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

 。踨oot@localhost scptest]#

  說(shuō)明:

  上傳本地目錄 /opt/soft/mongodb到遠(yuǎn)程機(jī)器192.168.120.204上/opt/soft/scptest的目錄中去

  上面就是使用scp命令實(shí)現(xiàn)Linux服務(wù)器之間的文件傳送的方法介紹了,如果你要進(jìn)行兩臺(tái)服務(wù)器之間的文件復(fù)制,只需使用scp一個(gè)命令就足夠了,無(wú)需在使用其他命令。

標(biāo)簽 命令 scp

發(fā)表評(píng)論

0

沒(méi)有更多評(píng)論了

評(píng)論就這些咯,讓大家也知道你的獨(dú)特見(jiàn)解

立即評(píng)論

以上留言?xún)H代表用戶(hù)個(gè)人觀點(diǎn),不代表系統(tǒng)之家立場(chǎng)

其他版本軟件

熱門(mén)教程

人氣教程排行

Linux系統(tǒng)推薦

官方交流群 軟件收錄