LinuxCommandLibrary

prezip

Pre-compress files for faster later compression

SYNOPSIS

prezip [options] [file1 file2 ...]

PARAMETERS

-v
    Verbose mode. Displays more information about the compression process.

-q
    Quiet mode. Suppresses most output messages.

-f
    Force compression. Compresses even if the file appears to be already compressed. Use with caution.

-o
    Specify the output directory for the compressed files. If not specified, compressed files overwrite the original files.

-d
    Decompress files. Equivalent to gunzip for the prezip-compressed files.

DESCRIPTION

The prezip command is a utility designed to pre-compress files individually before they are archived together. This is useful when dealing with a mixed set of files, some of which are already compressed (like images) and some which are highly compressible (like text files). Using prezip can potentially reduce the overall size of the final archive compared to compressing the entire archive directly, as already-compressed files won't be re-compressed further. It operates by checking if a file is likely compressible, and if so, compressing it using gzip. This prevents gzip from attempting to re-compress already-compressed files (jpeg, png, etc), avoiding increases in file size. The compressed files generally have a .gz extension added. Files that are not compressed by prezip are left unmodified. Prezip is often used in conjunction with archiving tools such as tar to create compressed archives.

CAVEATS

If an output directory is not specified with the -o option, prezip will overwrite the original files with their compressed versions. This is usually acceptable, but care should be taken to avoid data loss, specially when dealing with mission critical data or big sets of data.
Re-compressing already compressed files with the -f (force) flag can actually *increase* file size.

WORKFLOW EXAMPLE

A common workflow involves using prezip to compress individual files, followed by tar to create an archive:
prezip *.txt *.log
tar -cf archive.tar *.gz
This creates an archive 'archive.tar' containing the compressed .txt and .log files, originally named *.gz by prezip. Original files are lost if no out directory is specified.

SEE ALSO

gzip(1), gunzip(1), tar(1)

Copied to clipboard