How to use tar with lz4?

Daniel picture Daniel · Jun 5, 2014 · Viewed 20.9k times · Source

How to use tar and filter the archive through LZ4? Or any available tools? It looks cumbersome to use tar cvf folderABC.tar folderABC && lz4c -c0 folderABC.tar.

PS: *nix environment

Answer

Cyan picture Cyan · Jun 6, 2014

lz4 has a command line structure similar to gzip. Therefore, something like this will work :

tar cvf - folderABC | lz4 > folderABC.tar.lz4

or

tar cvf - folderABC | lz4 - folderABC.tar.lz4

First one compresses silently, like gzip. Second one is a bit more lz4-specific, and will also display summarized compression stats.