nc基础用法2

2022-04-23 19:07:31 浏览数 (1)

压缩打包发送

代码语言:javascript复制
[root@h102 nc]# tar -cvf - /tmp/vmware-root | gzip  | nc -l 3456
tar: Removing leading `/' from member names
/tmp/vmware-root/
/tmp/vmware-root/vmware-db.pl.1979
/tmp/vmware-root/vmware-db.pl.1972
/tmp/vmware-root/vmware-db.pl.1966
/tmp/vmware-root/vmware-db.pl.1991
/tmp/vmware-root/vmware-db.pl.1963
/tmp/vmware-root/vmware-db.pl.1969
/tmp/vmware-root/vmware-db.pl.1967
/tmp/vmware-root/vmware-db.pl.1948
/tmp/vmware-root/vmware-db.pl.1971
/tmp/vmware-root/vmware-db.pl.1965
/tmp/vmware-root/vmware-db.pl.1960
/tmp/vmware-root/vmware-db.pl.1975
/tmp/vmware-root/vmware-db.pl.1959
/tmp/vmware-root/vmware-db.pl.1958
/tmp/vmware-root/vmware-db.pl.1964
/tmp/vmware-root/vmware-db.pl.1968
/tmp/vmware-root/vmware-db.pl.1983
/tmp/vmware-root/vmware-db.pl.1976
/tmp/vmware-root/vmware-db.pl.1980
/tmp/vmware-root/vmware-db.pl.1977
/tmp/vmware-root/vmware-db.pl.1984
/tmp/vmware-root/vmware-db.pl.1962
/tmp/vmware-root/vmware-db.pl.1952
/tmp/vmware-root/vmware-db.pl.1961
/tmp/vmware-root/vmware-db.pl.1974
/tmp/vmware-root/vmware-db.pl.1944
----------
[root@h101 nc]# nc -v h102 3456 | zcat  |tar -xvf -

gzip: stdin: decompression OK, trailing garbage ignored
tmp/vmware-root/
tmp/vmware-root/vmware-db.pl.1979
tmp/vmware-root/vmware-db.pl.1972
tmp/vmware-root/vmware-db.pl.1966
tmp/vmware-root/vmware-db.pl.1991
tmp/vmware-root/vmware-db.pl.1963
tmp/vmware-root/vmware-db.pl.1969
tmp/vmware-root/vmware-db.pl.1967
tmp/vmware-root/vmware-db.pl.1948
tmp/vmware-root/vmware-db.pl.1971
tmp/vmware-root/vmware-db.pl.1965
tmp/vmware-root/vmware-db.pl.1960
tmp/vmware-root/vmware-db.pl.1975
tmp/vmware-root/vmware-db.pl.1959
tmp/vmware-root/vmware-db.pl.1958
tmp/vmware-root/vmware-db.pl.1964
tmp/vmware-root/vmware-db.pl.1968
tmp/vmware-root/vmware-db.pl.1983
tmp/vmware-root/vmware-db.pl.1976
tmp/vmware-root/vmware-db.pl.1980
tmp/vmware-root/vmware-db.pl.1977
tmp/vmware-root/vmware-db.pl.1984
tmp/vmware-root/vmware-db.pl.1962
tmp/vmware-root/vmware-db.pl.1952
tmp/vmware-root/vmware-db.pl.1961
tmp/vmware-root/vmware-db.pl.1974
tmp/vmware-root/vmware-db.pl.1944
[root@h101 nc]# ll
total 8
-rw-r--r-- 1 root root   11 Nov 17 18:59 f.txt
drwxr-xr-x 3 root root 4096 Nov 17 19:44 tmp
[root@h101 nc]# ll tmp/vmware-root/
total 104
-rw-r--r-- 1 root root 90 Oct 21 21:55 vmware-db.pl.1944
-rw-r--r-- 1 root root 90 Oct 21 21:55 vmware-db.pl.1948
-rw-r--r-- 1 root root 90 Oct 21 21:55 vmware-db.pl.1952
-rw-r--r-- 1 root root 90 Nov 17 17:07 vmware-db.pl.1958
-rw-r--r-- 1 root root 90 Nov  5 20:23 vmware-db.pl.1959
-rw-r--r-- 1 root root 90 Oct 21 21:55 vmware-db.pl.1960
-rw-r--r-- 1 root root 90 Oct 23 09:05 vmware-db.pl.1961
-rw-r--r-- 1 root root 90 Nov 17 17:07 vmware-db.pl.1962
-rw-r--r-- 1 root root 90 Nov  5 20:23 vmware-db.pl.1963
-rw-r--r-- 1 root root 90 Nov 16 19:59 vmware-db.pl.1964
-rw-r--r-- 1 root root 90 Oct 23 09:05 vmware-db.pl.1965
-rw-r--r-- 1 root root 90 Nov 17 17:07 vmware-db.pl.1966
-rw-r--r-- 1 root root 90 Nov  5 20:23 vmware-db.pl.1967
-rw-r--r-- 1 root root 90 Nov 16 19:59 vmware-db.pl.1968
-rw-r--r-- 1 root root 90 Oct 23 09:05 vmware-db.pl.1969
-rw-r--r-- 1 root root 90 Oct 28 11:28 vmware-db.pl.1971
-rw-r--r-- 1 root root 90 Nov 16 19:59 vmware-db.pl.1972
-rw-r--r-- 1 root root 90 Nov 17 17:07 vmware-db.pl.1974
-rw-r--r-- 1 root root 90 Nov  5 20:23 vmware-db.pl.1975
-rw-r--r-- 1 root root 90 Nov  8 18:21 vmware-db.pl.1976
-rw-r--r-- 1 root root 90 Oct 23 09:05 vmware-db.pl.1977
-rw-r--r-- 1 root root 90 Oct 28 11:28 vmware-db.pl.1979
-rw-r--r-- 1 root root 90 Nov 16 19:59 vmware-db.pl.1980
-rw-r--r-- 1 root root 90 Oct 21 09:26 vmware-db.pl.1983
-rw-r--r-- 1 root root 90 Nov  8 18:21 vmware-db.pl.1984
-rw-r--r-- 1 root root 90 Oct 21 09:26 vmware-db.pl.1991
[root@h101 nc]# 

Tip: 第二步中的 zcat 可以使用 gunzipgzip -d 替代

0 人点赞