This command will create a tar archive of directory 'dir' and compress it using gzip, the output file will be dir.tgz.
tar cf - dir | gzip -c > dir.tgz
This command will create a tar archive of directory 'dir' and compress it using gzip, the output file will be dir.tgz.
tar cf - dir | gzip -c > dir.tgz