将文件发送到其他的虚拟机
scp -r ~/projects/ user@hostB:/home/delta/projects/
scp file1 user@host:/path/to/dest/
scp-r /path/to/source/ user@host:/path/to/dest/
scp排除文件
使用 rsync 命令排除文件
rsync av -e ssh--exclude='*.out'/path/to/source/ user@hostB:/path/to/dest/
-a :递归到目录,即复制所有文件和子目录。另外,打开归档模式和所有其他选项(相当于 -rlptgoD)
-v :详细输出
-e ssh :使用 ssh 作为远程 shell,这样所有的东西都被加密
--exclude='*.out' :排除匹配模式的文件,例如 *.out 或 *.c 等。
rsync 命令的例子
从 ~/virt/ 目录递归地复制所有文件,但排除所有 *.new 文件:
$ rsync -av -e ssh--exclude='*.new'~/virt/ root@CentOS7:/tmp
查看更多手册
$ man rsync
$ manbash
$ manscp