compress to tgz linux

C++
tar -cvzf <name of tarball>.tgz /path/to/source/folder

Source

Also in C++: