1

I need to create a .Z (compress) file as the receiver is expecting to read it with uncompress utility. But I don't have the possibility to install compress package on my Linux host.

Is there a way to get the compressed .Z file (using adaptive Lempel-Ziv coding) with gzip command?

Stefano Radaelli
  • 1,088
  • 2
  • 15
  • 35
  • 1
    Why not just install the compress command? It should be part of your distro. On opensuse, it's in ncompress. – Bib Sep 17 '21 at 18:35
  • Because I'm not granted to install it. I should ask to my admin but formerly it would take time an authorization. If I have an alternative solution with gzip I would prefer, if not I would raise a request to install the package. – Stefano Radaelli Sep 17 '21 at 18:54
  • 2
    gzip does not do .Z files. If you have a C compiler, then I suggest you download the source from sourceforge and install it locally. If not, then raise the request. – Bib Sep 17 '21 at 20:25

2 Answers2

2

No. gzip cannot compress to the .Z format.

Download the source code for compress, compile it, and use it. (You do not need to have it installed on your system.)

Mark Adler
  • 101,978
  • 13
  • 118
  • 158
0

A couple of ideas:

  • scp your file to a system that is less hobbled and compress it there
  • use a docker image

You can run the fedora docker image like this with a "bind mount" so that the files on your local host are visible in /data in the container:

docker run -it --rm -v "$(pwd)":/data fedora

Then, inside the container, run:

yum install ncompress
compress SOMEFILE
exit

and your container will be removed and nothing will have been installed on your local host and you'll have a lovely, compressed SOMEFILE.Z

Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
  • I'd expect that the OP can't upload/copy arbitrary files to that machine. Otherwise it seems a bit of a non-issue. On something like Debian, I'd just download the appropriate .deb and grab the binary from there. Or, like you said, just compress it somewhere else. – Dan Mašek Sep 17 '21 at 21:29