Extract .gz files from CLI

This is an easy one, but one that results in a lot of Google searches whilst people learn the Linux ropes.

Change to the directory containing the compressed file (you don't have to, strictly-speaking).

Type the following command:

gunzip example-filename.gz

It will now extract the file. Job done.

If you have multiple files awaiting extraction, use a wildcard like so:

gunzip *.gz

Gunzip will then extract all the files in the directory ending with .gz

Posted by

Share: