Skip to content

Instantly share code, notes, and snippets.

@JohannesBuchner
Created September 22, 2021 12:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JohannesBuchner/f516c137c8634541f639bacec6e76d28 to your computer and use it in GitHub Desktop.
Save JohannesBuchner/f516c137c8634541f639bacec6e76d28 to your computer and use it in GitHub Desktop.
Better tar file compression by sorting similar files together
# Compression can be improved when files with the same or similar content
# are next to each other in the file list.
#
# This command sorts by reversed filenames, which places files
# together by file extension, filename and path, in that order.
# identify all files
find mypath/ -type f |
rev | sort | rev |
tar --no-recursion --files-from=- -cvzf myarchive.tar.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment