How to Zip , Tar Compress and Extract file on Linux
Zip and tar are the most popular command line compression tools on Linux systems. This tutorial will help you to learn about how to use zip and tar command line utilities to compress and extract files on Linux system.
Compress with Tar
A simple command to compress /var/log directory with tar command.
$ tar -cf logs.tar /var/log
You can also make more compressed file using tar with gzip format.
$ tar -czf logs.tar.gz /var/log
Compress with Zip
To compress files and directories with zip command.
$ zip -r logs.zip /var/log
Decompress with Zip
Decompress zip archived file.
$ unzip logs.zip
Decompress with Tar
Following command will decompress the logs.tar file
$ tar -xf logs.tar
To decompress the gzipped tar archive.
$ tar -xzf logs.tar.gz