Linux中的scp命令使用方法及技巧
linux系统中实现linux之间的文件和目录复制的命令为scp,它是secure copy的缩写,是linux系统里基于ssh登录,进行安全的远程文件拷贝命令,并且它是加密的。

基本格式:
scp [可选参数] file_source file_target
常用可选参数:
-r: 递归复制整个目录
- 将本地文件复制到其它服务器
scp sources.list.bak squid.conf.bak root@10.41.1.96:#未指定远程路径

scp sources.list.bak squid.conf.bak root@10.41.1.96:/tmp#指定远程路径

远端服务器:

- 将远程服务器的文件复制到本地
scp root@10.41.1.96:/root/df_test.sh /tmp

- 两台远程服务器之间复制文件
实现把远程服务器的/tmp目录下的df_test.sh文件复制到另外一台远程服务器/tmp目录下。
scp know_action@10.41.1.102:/tmp/df_test.sh root@10.41.1.97:/tmp


- 复制所有文件
使用通配符“*”,比如:
scp * know_action@10.41.1.102:/tmp/#将当前目录下的所有文件复制到远端服务器的/tmp目录下。
使用-r选项,比如:
scp –r know_action@10.41.1.102:/tmp /tmp#将远程服务器的/tmp目录复制到的本地的/tmp目录下。