@riking @april No, for that you just need the 'a' flag.

$ tar caf foo.tar.gz bar
$ tar caf foo.tar.xz bar
$ file foo.tar.*
foo.tar.gz: gzip compressed data
foo.tar.xz: XZ compressed data

Also if you're using bsdtar:

$ tar caf foo.zip bar
$ tar caf foo.7z bar
$ file foo.*
foo.7z: 7-zip archive data
foo.zip: Zip archive data