tar | Cheatsheet
Compress with max compression
env GZIP=-9 tar cvzf file.tar.gz /path/to/directory
Use Gzip instead of tar
tar -cvf files.tar /path/to/file0 /path/to/file1; gzip -9 files.tar
Create xz archive
XZ_OPT=-9 tar -Jcvf file.tar.xz /path/to/directory
Create a gzip archive
tar cv /path/to/directory | gzip --best > file.tar.g
Create xz with max compression
tar cv path/to/data | xz -9 > file.tar.xz
Create gzip with multi cores
tar cf - paths-to-archive | pigz -9 -p 32 > archive.tar.gz
Compress multiple folders
for folders in ./*;
tar cv $folders|xz -9 > $folders.tar.gz;
done
Compress with pigz
tar --use-compress-program="pigz --best --recursive" -cf archive.tar.gz YourData
tar -I pigz -xf /mnt/sd/current/backup/bigbackup_web.tar.gz -C /tmp