COMPRESS AND DECOMPRESS .GZ, .TAR.GZ, AND .ZIP BY COMMAND LINE ON LINUX

It's a note for my future self, that every time I need it I have to look it up on Google. This way I already have it more handy and easy to find.

.tar.gz files:

Compress: tar -czvf packaged.tar.gz /folder/to/package/

Unzip: tar -xzvf archive.tar.gz

.tar files:

Pack: tar -cvf package.tar /dir/to/compress/

Unpack: tar -xvf package.tar

.gz files:

Compress: gzip -9 index.php

Unzip: gzip -d index.php.gz

.zip files:

Compress: zip file.zip folder

Unzip: unzip archive.zip

Need a Drupal Expert?

Senior Drupal developer, freelance, specialized in what's hardest: migrations, multilingual sites, SaaS platforms and Stripe integration. I leverage AI to cut delivery times and costs, with expert review on every line of code.

No agency, no middlemen. Direct contact with the one who does the work.