0

By default on a UNIX machine install, I can see the logs are rotated with gzip.

Question: Why doesn't the UNIX world use by default 7z? It would be much more efficient than gzip..

I just compressed a directory with many HTML files.

7z: 1,8 MByte

zip: 440 MByte

  • There was some discussion here on the topic superuser.com/questions/205223/pros-and-cons-of-bzip-vs-gzip – UVV Sep 2 '14 at 6:09
  • 7z isn't installed by default on most UNIX (Solaris, HP-UX or AIX) - you have to get it separately on those, the vendors don't package it. I'm not even sure it's installed by default on most Linux distributions. – Mat Sep 2 '14 at 6:12
5

Archiving (grouping files in a single entity) and compressing are usually done in separate steps under Unix.

That gives more flexibility when you want to manipulate single files (that wouldn't benefit from archiving) — think pipelines such as gzip -cd mylog.gz | grep '^Oct.*error'. Achieving the same with 7z would be awkward.¹

7z (and zip, and rar, and arj, and...) are archivers that happen to compress. They wouldn't replace traditional gzip as they do not have the same purpose.

gzip is fast, light on resources, very well-known and installed on most Unix systems. If you're looking for a higher-performance compressor, go for xz. It offers a command line interface very similar to gzip but uses more or less the same LZMA algorithms as 7z so you should get similar compression ratios.


1) The above pipeline is so common that many wrappers exist around gzip tools; a seasoned user would probably opt for zgrep '^Oct.*error' mylog.gz to save a few keystrokes.

| improve this answer | |
0

With logrotate, log files can be compressed only one file at a time (that's a limitation, and not really a problem in practice, IMHO), and gzip is used by default, most probably for historical reasons and it has not changed yet. You can still use another compressor with the compresscmd command. See the logrotate(8) man page for more information.

In the future, logrotate might have a different default. I suppose that the best compressor nowadays is xz, but it's still rather new.

If you use different log rotation software, see its documentation.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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