Comment by mkl

Comment by mkl 20 hours ago

3 replies

> tar -cf archive.tar.gz foo bar

This will create an uncompressed .tar with the wrong name. You need a z option to specify gzip.

Intermernet 19 hours ago

Apparently this is now automatically determined by the file name, but I still habitually add the flag. 30 years of muscle memory is hard to break!

  • mkl 18 hours ago

    I tried it to check before making the comment. In Ubuntu 25.04 it does not automatically enable compression based on the filename. The automatic detection when extracting is based on file contents, not name.

    • BenjiWiebe 2 hours ago

      If you add a for auto, it will choose the right compression based on the file name.

      tar -caf foo.tar.xz foo

      Will be an xz compressed tarball.