To archive and compress a directory called 'target' in the current working directory into a file called target.tgz use:
tar cf - target | gzip -c > target.tgz |
The - in the place of a tar output filename directs tar to send its output to the standard output which is redirected to gzip.