Use LZ4 with tar for compress multiple directories

lz4 is an extremely fast lossless compression algorithm, based on byte-aligned LZ77 family of compression scheme. lz4 offers compression speeds of 400 MB/s per core, linearly scalable with multi-core CPUs. It features an extremely fast decoder, with speed in multiple GB/s per core, typically reaching RAM speed limit on multi-core systems. The native file format is the .lz4 format. But lz4 accept input with files only if want to compress directory we need to tar them into tar files before compress it.

First install lz4

apt install liblz4-tool

Then compress it

tar cf - dir1 dir2 dir3 dirX | lz4 -v > file_name.tar.lz4
OR
tar cf - dir_pattern* | lz4 -v > file_name.tar.lz4

Finally decompress it

lz4 -d -v file_name.tar.lz4 | tar xf - -C /target/directory

 

โซเชียล

Kawin Viriyaprasopsook

System administrator at Zercle Technology Co., Ltd.
System admin กากๆ
รักในการเล่นเกม
ชอบดู Anime ญี่ปุ่น
โซเชียล

Leave a Reply