Linux SCP和SSH命令
平時做Oracle實驗、經常會在多個主機間傳數據或者登入、這兩個命令經常用到
這裡以最簡單的實例介紹一下、以免自己忘了
㈠ SCP www.2cto.com
scp是在兩台機器間復制傳輸數據的命令、其實質相當於利用SSH協議來傳輸數據的cp命令
復制遠程服務器的文件到本地:
[plain]
[root@Think ~]# scp 192.168.1.117:/home/oracle/water.txt /root/Desktop
[email protected]'s password:
water.txt 100% 10KB 10.1KB/s 00:00
www.2cto.com
復制遠程服務器的目錄到本地:
[plain]
[root@Think ~]# scp -r 192.168.1.117:/home/oracle/ /root/Desktop
[email protected]'s password:
copy.sh 100% 1375 1.3KB/s 00:00
sqlnet.log 100% 766 0.8KB/s 00:00
復制本地的文件到遠程服務器:
[plain]
[root@Think Desktop]# scp Think.sql 192.168.1.117:/root/Desktop
[email protected]'s password:
Think.sql 100% 0 0.0KB/s 00:00
復制本地的目錄到遠程服務器:
[plain]
[root@Think ~]# scp -r /root/Desktop 192.168.1.117:/root/Desktop
[email protected]'s password:
a 100% 17 0.0KB/s 00:00
login.sql 100% 638 0.6KB/s 00:00
㈡ SSH
不指定用戶:
[plain]
[root@Think ~]# ssh 192.168.1.117
[email protected]'s password:
Last login: Fri Mar 8 20:49:53 2013
www.2cto.com
指定用戶:
[plain]
[root@Think ~]# ssh -l oracle 192.168.1.117
[email protected]'s password:
或者
[root@Think ~]# ssh
[email protected]
[email protected]'s password:
Last login: Fri Mar 8 21:42:06 2013 from 192.168.1.118