How to compress / zip a directory in Linux

To compress in tar.gz format:

tar -cv /directory | gzip > archive.tar.gz

To decompress the tar.gz file:

tar -zxvf archive.tar.gz

Leave a Comment