How to use tar with lz4?

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.


On GNU tar, you can use -I lz4

Both FreeBSD and GNU tar seems to support --use-compress-program=lz4 as well.

tar -I lz4 -cf archive.tar.lz4 stuff to add to archive
tar -I lz4 -xf archive.tar.lz4

or

tar --use-compress-program=lz4 -cf archive.tar.lz4 stuff to add to archive
tar --use-compress-program=lz4 -xf archive.tar.lz4