7-zip LZMA file compression on Linux/Mac/Windows

Related: LZIP is better than 7-zip

7-zip is a popular LZMA cross-platform compression algorithm.


  • Cygwin (Windows): setup-x86_64 -P p7zip
  • Linux: apt install p7zip
  • MacOS
  • Windows


  • Compress: 7z a huge.7z huge.dat
  • Extract: 7z e huge.7z
enable multithreading (far faster compression)
enable LZMA2 compression (more advanced)
like “fast” compression.

Example 7-zip for very large files (100s of gigabytes or terabyte-size files)

7z a -t7z -mx=3 -mmt=on -m0=lzma2  mycomp.7z *.txt
  • higher compression settings might not add a lot of compression but can take vastly longer.