create gz in ubuntu

C++
tar -czf tarball.tar.gz my_directory/ gzip -9  yourName_db.sql
Source

Also in C++: