scp是在两台机器间复制传输数据的命令、其实质相当于利用SSH协议来传输数据的cp命令
复制远程服务器的文件到本地:
- [root@Think ~]# scp 192.168.1.117:/home/oracle/water.txt /root/Desktop
- root@192.168.1.117‘s password:
- water.txt 100% 10KB 10.1KB/s 00:00
复制远程服务器的目录到本地:
- [root@Think ~]# scp -r 192.168.1.117:/home/oracle/ /root/Desktop
- root@192.168.1.117‘s password:
- copy.sh 100% 1375 1.3KB/s 00:00
- sqlnet.log 100% 766 0.8KB/s 00:00
复制本地的文件到远程服务器:
- [root@Think Desktop]# scp Think.sql 192.168.1.117:/root/Desktop
- root@192.168.1.117‘s password:
- Think.sql 100% 0 0.0KB/s 00:00
复制本地的目录到远程服务器:
- [root@Think ~]# scp -r /root/Desktop 192.168.1.117:/root/Desktop
- root@192.168.1.117‘s password:
- a 100% 17 0.0KB/s 00:00
- login.sql 100% 638 0.6KB/s 00:00
㈡ SSH
不指定用户:
- [root@Think ~]# ssh 192.168.1.117
- root@192.168.1.117‘s password:
- Last login: Fri Mar 8 20:49:53 2013
指定用户:
- [root@Think ~]# ssh -l oracle 192.168.1.117
- oracle@192.168.1.117‘s password:
- 或者
- [root@Think ~]# ssh oracle@192.168.1.117
- oracle@192.168.1.117‘s password:
- Last login: Fri Mar 8 21:42:06 2013 from 192.168.1.118