- 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
```
> 将要拷贝的目录或文件进行打包,-代表标准输出,然后再ssh传输到目标主机,运行相应的命令,tar xvf -将前面的标准输出内容作为解包对象
新闻热点
疑难解答