Created
July 20, 2014 06:12
-
-
Save baruch/106a3da12187b284830e to your computer and use it in GitHub Desktop.
Optimal tar compression
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.