Tar: Auto detecting the compression type
The Linux tar
command has a cool feature to auto-detect the file compression based on the archive suffix.
-a, --auto-compress
use archive suffix to determine the compression program
This allows you to change file compressions by just changing the archive suffix:
tar -cvpaf /tmp/backup.tar.gz ~/
tar -cvpaf /tmp/backup.tar.bz2 ~/
tar -cvpaf /tmp/backup.tar.xz ~/
This saves you having to specify -z
-j
or -J
respectively.