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.
gunzip -h
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.
Report bugs to <bug-gzip@gnu.org>.
I don’t know what’s going on, the help documents of the two commands are the same, the developer is lazy
In other words, -c does not compress the file, but outputs it directly to standard output.
gunzip -, instead of receiving a compressed file from a file, it receives it from standard input.
gzip -c aa.txt: Compress the aa.txt file and output the compressed result to standard output
ssh root@192.168.1.1 "命令":Execute commands
on the remote machine
Commandgunzip -c -: Decompress the file. The original compressed file is passed in from the standard input, and the output result is directly output to the standard output
Explanation of command parameters:
gzip -h
gunzip -h
I don’t know what’s going on, the help documents of the two commands are the same, the developer is lazy
In other words,
-c
does not compress the file, but outputs it directly to standard output.gunzip -
, instead of receiving a compressed file from a file, it receives it from standard input.|
:管道>
: redirectAnalysis of the entire command
gzip -c aa.txt
: Compress the aa.txt file and output the compressed result to standard outputssh root@192.168.1.1 "命令":
Execute commandsCommand
gunzip -c -
: Decompress the file. The original compressed file is passed in from the standard input, and the output result is directly output to the standard output> /home/bb.txt
:将标准输出重定向到文件/home/bb.txt
Such an operation on a folder will fail
gzip does not support directory operations
You can either completely switch to using netcat for sending and receiving.
Or, compress it with local tar and decompress it on the opposite end.
Piping takes the output of the previous command as input. You can also compress it into a temporary file first and then use scp