Archive Manager, or file-roller, doesn't seem to have the option to set the compression level for 7z files.

enter image description here

However, the windows client 7-zip has an option to do so using GUI -

enter image description here

On Ubuntu/Linux, one can set the compression level in the command line (CLI) using the -m flag. For details, refer to this answer.

Is there any provision for setting the compression level for 7z archives using GUI in Ubuntu?

  • To the best of my knowledge, it uses the ultra level, by default! – blade19899 Dec 17 '14 at 14:53
  • @blade19899 The default level is 5 (Normal) – Rohith Madhavan Dec 17 '14 at 14:54
  • You schooled me. The only option is by using the commandline version. And submit a feature request! To the best of my knowledge :) – blade19899 Dec 17 '14 at 14:55
  • I think it's about the same algorithm as xz normally uses, and the higher compression levels could require "several gigabytes" of ram (so says man xz) - It's not like zip where specifying "max" all the time is the best idea. – Xen2050 Dec 17 '14 at 15:52
  • That depends on the size of the files to be archived. For practical purposes, the RAM requirement is not much of an issue. – Rohith Madhavan Dec 17 '14 at 16:42
up vote 16 down vote accepted

My idea was to find some hint in the file listing of the packages or in gconf, but I had no luck. Someone else knew the answer though.

Superuser: Change default compression levels for file-roller?

Either:

$ dconf write /org/gnome/file-roller/general/compression-level "'maximum'"

Or:

$ dconf-editor
  1. Select org in the left-hand pane.
  2. Select gnome in the left-hand pane.
  3. Select file-roller in the left-hand pane.
  4. Select general in the left-hand pane.
  5. Select compression-level in the right-hand pane.
  6. Set compression-level to 'maximum'.

Unfortunately, you cannot fine-tune this setting for different compression programmes. If you want all the freedom, you can use your shell instead.

Image of dconf Editor with file-roller's compression-level set to maximum..

That answer previously had no upvotes, so I checked if this has any effect at all and choose to compress some documents with the default settings and with maximum settings (type 7z). Result: 2,3 KB improvement on a ~300 KB archive.

Caution:

  • Depending on the content it can have a negative impact to compress everything with LZMA/LZMA2 on level maximum. PNGs for example are already compressed with Deflate and won't gain much from compression. It would make more sense to optimize them with PNGOUT/OptiPNG, Zopfli and then archive them with LZ4, achieving faster archive decompression and reducing file size.

I tried to find out more through file-rollers manpage and user manual, still no luck. Then I dowloaded the source package and searched for "maximum" in fr-command-7z.c (note how I avoid to say I read the source), which gave me the following:

switch (archive->compression) {
case FR_COMPRESSION_VERY_FAST:
    fr_process_add_arg (command->process, "-mx=1");
    break;
case FR_COMPRESSION_FAST:
    fr_process_add_arg (command->process, "-mx=5");
    break;
case FR_COMPRESSION_NORMAL:
    fr_process_add_arg (command->process, "-mx=7");
    break;
case FR_COMPRESSION_MAXIMUM:
    fr_process_add_arg (command->process, "-mx=9");
    if (! _g_mime_type_matches (archive->mime_type, "application/zip")
        && ! _g_mime_type_matches (archive->mime_type, "application/x-cbz"))
    {
        fr_process_add_arg (command->process, "-m0=lzma2");;
    }
    break;
}

That's as far as I can currently get, it seems like there is no ultra setting.

  • 1
    Although the method suggested may improve the compression levels, it requires the user to change values in the dconf-editor each time a different level is required. Is there any method where the compression levels are selected dynamically? – Rohith Madhavan Dec 17 '14 at 23:29
  • +1 for the answer. Although it does not exactly solve the problem, it provides an alternative solution. – Rohith Madhavan Dec 17 '14 at 23:42
  • @RohithMadhavan I understand what you mean. I'm trying not to blame anyone here, but I think that is how default Gnome applications are intended to work: you can enable hidden features but you won't find a lot of checkboxes and dropdown menus. – LiveWireBT Dec 18 '14 at 10:09
  • I guess you are right. I may try to file a feature request, maybe to be included under advanced options. Thanks :-) – Rohith Madhavan Dec 18 '14 at 11:15

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.