gzip

Compress single files with the widespread deflate format

About

The standard single-item compressor. Its .gz output is understood almost everywhere. The original name and timestamp are kept inside the stream, and it pairs with the archiver for whole trees.

Install it

pkg install gzip

Run this inside Termux. If the package is already present, pkg will say so and do nothing.

Commands worth knowing

6 of the invocations you will actually reach for. Tap the copy button to put one on your clipboard.

gzip -k notes.txt Compress an entry in place. The original stays beside the smaller copy.
gzip -d notes.txt.gz Decompress an archive back to its original form.
gzip -l notes.txt.gz Report the compressed and uncompressed sizes plus the ratio. Nothing changes.
gzip -9 backup.sql Compress with the slowest, smallest setting. For when space beats speed.
gzip -r logs/ Walk a directory and compress every entry inside it.
gzip -c notes.txt Write the compressed stream to standard output. Another command can then take it.

Worked example

Run gzip -l *.gz and this is what you should see.

termux
$ gzip -l *.gz
         compressed        uncompressed  ratio uncompressed_name
                812                2048  60.4% notes.txt
               1204                4096  70.6% todo.txt

Developed by

GNU Project .