Skip to content

Instantly share code, notes, and snippets.

@baruch
Created July 20, 2014 06:12
Show Gist options
  • Save baruch/106a3da12187b284830e to your computer and use it in GitHub Desktop.
Save baruch/106a3da12187b284830e to your computer and use it in GitHub Desktop.
Optimal tar compression
find $d -type f | rev | sort | rev | tar -c -T /dev/stdin -f - | pv -pterb -B 10m -s $(du -ms $d | cut -f1)m -W -i 10 | bzip2 -6 > $d.tar.bz2;
@baruch
Copy link
Author

baruch commented Jul 20, 2014

The idea is to have all the files sorted by suffix as this provides the largest gain for compression by increasing the chance to find repeating strings.

The pv is for progress meter and can be omitted if not installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment