Skip to content

Instantly share code, notes, and snippets.

@minlaxz
Last active May 23, 2021 09:44
Show Gist options
  • Save minlaxz/d208531df4489b091e76216d40f025f9 to your computer and use it in GitHub Desktop.
Save minlaxz/d208531df4489b091e76216d40f025f9 to your computer and use it in GitHub Desktop.
How to parallel compress tarballs.

Parallel Compressed Tarballs

Compressing a Dir

Pipe method =>

tar cvf - ./videos | pixz > oneFile.tpxz
  • c --create
  • v --verbose
  • f --file but (-) means go to stdout
  • | --stdout is piped to pixz stdin
  • pixz>file --pixz is redirect it's stdout to a file using >.

Tar method =>

tar -Ipixz -cvf oneFile.tpxz ./videos

Compressing a File

tar cvf - anyFile | pixz > anyFile.tpxz
tar -Ipixz -cvf anyFile.tpxz ./anyFile
pixz -i anyFile -o anyFile.tpxz
pixz < anyFile > anyFile.tpxz

Decompression

tar -Ipixz -zvf File.tpxz -C output/dir
pixz -dk File.tpxz | tar xvf -    # (failed)
pixz -dk File.tpxz -o outfile.tar && tar xvf outfile.tar -C output/dir
  • k --keep orig file
  • d --decompress

To extract one file from tpxz (tarball parallel xz)

pixz -x ./vid/1.mp4 < new.tpxz | tar x 

To extract * from tpxz

pixz -x < new.tpxz | tar x

Thoughts -dk decompress keep orig will decompress tpxz to tar, so I pipe | it to tar -x then failed. I had to seperate two commads using &&

if I want to extract * from tpxz just uing this pixz -x < file.tpxz | tar x about command with | tar x will stdout extracted files to terminal so that pipping should work.

  • decompress will produce tarball
  • extract will produce stdout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment