← All commands
THE COMMAND REFERENCE

znew

Recompress .Z files from the old compress tool as gzip files.

Last updated

Portable / common

Implementation-level reference; examples are not certified for every installed version.

Overview

znew converts files made by the old compress tool (names ending in .Z) to gzip files (ending in .gz), which are usually smaller. It checks the new file before removing the old one. It matters only if you still have .Z files, which is rare today.

Background

The macOS manual describes znew as converting compressed files to gzipped files. Today the name covers the GNU gzip script znew and the znew on macOS. The BusyBox 1.37.0 build used for this page has no znew applet. The examples on this page were reviewed against the manuals but not executed, because making a .Z file needs the compress program, which is on macOS but not on the Linux guest.

Examples

Convert one .Z file to a .gz file; the .Z file is replaced:

znew old.Z

Convert several files and keep the .Z originals with -K:

znew -K one.Z two.Z

Options

-K
Keep the .Z file if it is smaller than the .gz file.

Common mistakes

znew only handles files that end in .Z. It needs both gzip and a program that can read the old format, so it can fail on a system without it. Check the result before deleting backups.

Portability

This page has no BusyBox view: BusyBox has no znew applet. The examples were reviewed only. The GNU versions are shell scripts, which the implementation probe never runs, so they are not identified automatically; the Linux guest ran them anyway.

References

Original explanations, with upstream documentation for further reading. FreeBSD references are comparison material, not a claim of Apple version equivalence.