看到可以用一条命令传输文件
gzip -c aa.txt | ssh root@192.168.1.1 " gunzip -c - > /home/bb.txt"
请问这条命令怎么理解?
还有,发现对文件夹进行这样的操作会失败,有什么办法传输文件夹么?
求指教
大家讲道理2017-04-18 10:21:20
gzip -h
リーリーガンジップ -h
リーリー何が起こっているのか分かりません、2つのコマンドのヘルプドキュメントは同じです、開発者は怠け者です
つまり、-c
はファイルを圧縮せず、標準出力に直接出力します。 -c
不压缩文件,而是直接输出到标准输出。
gunzip -
,不是从文件接收压缩文件,而是从标准输入接收。
|
:管道>
:重定向
Usage: gzip [OPTION]... [FILE]...
Compress or uncompress FILEs (by default, compress FILES in-place).
Mandatory arguments to long options are mandatory for short options too.
-c, --stdout write on standard output, keep original files unchanged
-d, --decompress decompress
-f, --force force overwrite of output file and compress links
-h, --help give this help
-l, --list list compressed file contents
-L, --license display software license
-n, --no-name do not save or restore the original name and time stamp
-N, --name save or restore the original name and time stamp
-q, --quiet suppress all warnings
-r, --recursive operate recursively on directories
-S, --suffix=SUF use suffix SUF on compressed files
-t, --test test compressed file integrity
-v, --verbose verbose mode
-V, --version display version number
-1, --fast compress faster
-9, --best compress better
--rsyncable Make rsync-friendly archive
With no FILE, or when FILE is -, read standard input.
gzip -c aa.txt
:压缩aa.txt文件,并将压缩后的结果输出到标准输出
ssh root@192.168.1.1 "命令":
在远程机器上执行命令
命令gunzip -c -
:解压文件,原压缩文件是由标准输入传入的,输出结果直接输出到标准输出
> /home/bb.txt
:将标准输出重定向到文件/home/bb.txt
gunzip -
は、圧縮ファイルをファイルから受け取るのではなく、標準入力から受け取ります。 |
: パイプ>
: リダイレクト リーリー
gzip -c aa.txt
: aa.txt ファイルを圧縮し、 圧縮結果を標準出力に出力します🎜🎜
ssh root@192.168.1.1 "command":
リモート マシンでコマンドを実行します🎜🎜
gunzip -c -
: ファイルを解凍し、元の圧縮ファイルを標準入力から渡し、出力結果をそのまま標準出力に出力します🎜🎜
> /home/bb.txt
: 標準出力をファイル /home/bb.txt
にリダイレクトします🎜🎜
🎜
🎜
🎜フォルダーに対するこの操作は失敗します🎜
🎜gzip はディレクトリ操作をサポートしていません🎜