system enabled verified low v1.0.0

gzip

File compression utility using the DEFLATE algorithm for reducing file sizes with optional decompression and stream processing.

📋 Live Preview
gzip {stdout} {decompress} {force} {help} {keep}
๐Ÿ“Ž stdout ๐Ÿ“Ž decompress ๐Ÿ“Ž force ๐Ÿ“Ž help ๐Ÿ“Ž keep
gzip {stdout} {decompress} {force} {help} {keep}

Sandbox: execFile · Timeout: 300s

Capabilities

filesystem.compress.gzip
filesystem.decompress.gzip
filesystem.compress.stream
filesystem.archive.compress

Parameters

Name Type Required Default Description Aliases
stdout string No - write on standard output, keep original files unchanged -c, --stdout
decompress string No - Set the decompress parameter -d, --decompress
force file No - force overwrite of output file and compress links -f, --force
help string No - give this help -h, --help
keep file No - keep (don't delete) input files -k, --keep
list string No - list compressed file contents -l, --list
license string No - display software license -L, --license
no-name string No - do not save or restore the original name and timestamp -n, --no-name
name string No - save or restore the original name and timestamp -N, --name
quiet string No - suppress all warnings -q, --quiet
recursive string No - operate recursively on directories -r, --recursive
rsyncable string No - make rsync-friendly archive --rsyncable
suffix string No - --synchronous synchronous output (safer if system crashes, but slower) -S, --suffix
test string No - test compressed file integrity -t, --test
verbose string No - verbose mode -v, --verbose
version string No - display version number -V, --version
fast string No - compress faster -1, --fast
best string No - compress better -9, --best
synchronous boolean No - synchronous output (safer if system crashes, but slower) --synchronous

Artifacts

TypeDescriptionMIMESchemaTrust
filesystem.archive.gzipGzip-compressed fileapplication/gzip1.0.0verified
filesystem.file.rawDecompressed file content--verified

Contract

Inputs

filesystem.file.raw

File to compress

filesystem.archive.gzip

Gzip archive to decompress

Outputs

filesystem.archive.gzip

Compressed gzip archive

filesystem.file.raw

Decompressed file content

Side effects: filesystem_write

Workflow Edges

Produces

filesystem.archive.gzipfilesystem.file.raw

Consumes

filesystem.file.rawfilesystem.archive.gzip

Resource Profile

ResourceValue
CPUhigh
Memory32 MB
Networknone
Disk I/Ohigh

Examples

Compress a file

gzip file.txt

Decompress a .gz file

gunzip file.txt.gz

Compress with maximum compression

gzip -9 largefile.tar

Keep original file when compressing

gzip -k file.txt

Stream compression in a pipeline

cat largefile | gzip -c > output.gz

View compressed file contents

zcat file.txt.gz

Documentation

Gzip โ€” File Compression

Gzip (GNU zip) is a widely used compression utility based on the DEFLATE algorithm. It provides a good balance of compression ratio and speed, making it the standard for text compression on Unix systems.

Compression Levels

Level Flag Speed Size Reduction Use Case
1 --fast Fastest Lowest Quick compression, already-compressed data
6 (default) Good Good General purpose
9 --best Slowest Highest Archival, distribution

Pipeline Usage

# Compress a tar archive
tar cf - directory/ | gzip -c > archive.tar.gz

# Decompress and extract
gunzip -c archive.tar.gz | tar xf -

# Search compressed files without decompressing to disk
zcat access.log.gz | grep 'ERROR'

# Count lines in compressed file
zcat data.txt.gz | wc -l

# Stream compression over pipe
mysqldump database | gzip -c > backup.sql.gz

Compression Ratios

File Type Typical Ratio Notes
Text/Code 60-80% Highly compressible
Logs 70-90% Very high compression
JSON/XML 70-85% Repeated patterns compress well
Images (PNG) 0-5% Already compressed
Archives 0-10% Usually already compressed

Related Tools

  • bzip2 โ€” Better compression ratio, slower
  • xz โ€” Best compression ratio, very slow
  • zstd โ€” Modern, fast, good ratio
  • tar โ€” Often used together with gzip

Related Tools

gunzipzcatbzip2xzzstd

References