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.



Note: Replies will be formatted with PHP Markdown Extra syntax.

Name: Email (Not Required):
 
Logged IP: 3.139.81.58
To prevent spam please submit by clicking the kitten: