Use the tar (tape archive) command to compress your files and folders. It is similar to creating .ZIP files in Windows environment.
Syntax: tar -zcvf <output tar file> <source file>
Example: tar -zcvf outputfile.tar.gz source file
Here’s what those switches actually mean:
-c: Create an archive.
-z: Compress the archive with gzip.
-v: Display progress in the terminal while creating the archive, also known as “verbose” mode. The v is always optional in these commands, but it’s helpful.
-f: Allows you to specify the filename of the archive.