Linux command
gunzip 命令
网络
复制后可按需替换文件名、目录或参数。
常用示例
Decompress a file
gunzip [file.gz]
Decompress keeping original file
gunzip -k [file.gz]
Decompress to stdout
gunzip -c [file.gz]
Decompress multiple files
gunzip [file1.gz] [file2.gz]
Test compressed file integrity
gunzip -t [file.gz]
List compression information
gunzip -l [file.gz]
Force decompression
gunzip -f [file.gz]
Verbose output
gunzip -v [file.gz]
Decompress a file with a custom suffix
gunzip -S [.zz] [file.zz]
Recursively decompress
gunzip -r [directory/]
说明
gunzip decompresses files compressed by gzip, zip, compress, or pack. It is equivalent to `gzip -d`. For each compressed file, gunzip creates the uncompressed version and removes the .gz extension. The tool automatically detects the compression format and handles .gz, .z, .Z, and .tgz extensions. Files created by gzip can be recovered even if corrupted, with gunzip replacing damaged blocks with zeros. gunzip preserves the original file's name, timestamp, and permissions stored in the compressed file header.
参数
- -c, --stdout
- Write to stdout, keep original files.
- -f, --force
- Force decompression even with warnings.
- -k, --keep
- Keep compressed files.
- -l, --list
- List compression ratio.
- -n, --no-name
- Don't restore original name/timestamp.
- -N, --name
- Restore original name/timestamp (default).
- -q, --quiet
- Suppress warnings.
- -r, --recursive
- Recurse into directories.
- -t, --test
- Test integrity.
- -S _suffix_, --suffix _suffix_
- Use the given suffix instead of .gz.
- -v, --verbose
- Verbose output showing name and compression ratio.
- -1 to -9
- Ignored by gunzip; accepted for compatibility with gzip.
FAQ
What is the gunzip command used for?
gunzip decompresses files compressed by gzip, zip, compress, or pack. It is equivalent to `gzip -d`. For each compressed file, gunzip creates the uncompressed version and removes the .gz extension. The tool automatically detects the compression format and handles .gz, .z, .Z, and .tgz extensions. Files created by gzip can be recovered even if corrupted, with gunzip replacing damaged blocks with zeros. gunzip preserves the original file's name, timestamp, and permissions stored in the compressed file header.
How do I run a basic gunzip example?
Run `gunzip [file.gz]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -c, --stdout do in gunzip?
Write to stdout, keep original files.