- LinuxA:192.168.81.130
```
[root@localhost test]# ls
hello.txt
```
- LinuxB:192.168.81.131
```
[root@localhost ~]# ls
anaconda-ks.cfg
```
- LinuxA:192.168.81.130
```
[root@localhost test]# tar -cvf - hello.txt | ssh 192.168.81.131 "cd /home/ ; tar xvf -"
hello.txt
root@192.168.81.131's password:
hello.txt
```
- LinuxB:192.168.81.131
```
[root@localhost ~]# ls
anaconda-ks.cfg hello.txt
```
> 將要拷貝的目錄或文件進(jìn)行打包,-代表標(biāo)準(zhǔn)輸出,然后再ssh傳輸?shù)侥繕?biāo)主機(jī),運(yùn)行相應(yīng)的命令,tar xvf -將前面的標(biāo)準(zhǔn)輸出內(nèi)容作為解包對(duì)象