Usando gzip

The following examples illustrate typical uses of the command gzip for compressing (or “packaging”) a file into an “archive file”.

gzip archivefile1.txt

This command compresses the file archivefile1.txt and replaces it with the compressed version named “archivefile1.txt.gz”.

If you want to keep the uncompressed version, you can use the -c option, which writes to standard out, and then re-direct (“>”) standard out to a file like this:

gzip -c archivefile1.txt > archivefile1.txt.gz

The “.gz” file extension is commonly used by the compression program gzip, which is the counter part ofgunzip.

You can use the “-r” option to recursively compress all the files under the specified directory:

gzip -r documents_folder
For all available options of the gzip command see theman page.

Don’t Stop Here

More To Explore