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. Install 7-zip by:

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

Examples

  • Compress: 7z a huge.7z huge.dat
  • Extract: 7z e huge.7z
-mmt=on
enable multithreading (far faster compression)
-m0=lzma2
enable LZMA2 compression (more advanced)
-mx=3
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.

Leave a Comment