How to compress a file into zip format without having zip package installed? Pretty much what I need to do. I tried tar -czf loremipsum.zip
but the format isn't a correct zip format when I try to uncompress it on windows. I'm limited and won't be able to install the package. Is there any work around?
Asked
Active
Viewed 1,514 times
1

DopeGhoti
- 76,081

Julian Alwandy
- 111
-
What operating system and version are you running? – Mark Plotnick Jul 20 '18 at 17:47
2 Answers
4
A number of tools can create zip files, perhaps one of them will be available...
7-Zip can be used as follows:
7z a yourzip.zip files ...
Java’s JAR can also be used, as follows:
jar cMf yourzip.zip files ...
(the M
option tells jar
not to create a manifest).
You could also download zip
and run that instead of relying on a copy installed on the system, it has hardly any dependencies:
wget ftp://ftp.info-zip.org/pub/infozip/unix/linux/unz551x-glibc.tgz ftp://ftp.info-zip.org/pub/infozip/unix/linux/zip23x-glibc.zip
tar xf unz551x-glibc.tgz unzip-5.51/unzip
unzip-5.51/unzip zip23x-glibc.zip zip
This will extract a zip
binary which you can then use to create your zip file.

Stephen Kitt
- 434,908
0
tar
doesn't know how to handle PKZIP files. If you want to use tar
, your options are "gzip" (z
), "bzip2" (j
), and "compress" (Z
).

DopeGhoti
- 76,081
-
1... and
xz
(J
), andlzip
(--lzip
), andlzma
(--lzma
), andlzop
(--lzop
) ;-). – Stephen Kitt Jul 20 '18 at 15:18 -
-
1Of course. But the latest,
J
, was given its current meaning in 2009... – Stephen Kitt Jul 20 '18 at 16:25 -
It does not appear on the manual page for the implementation of
tar
in MacOS 10.13, dated 12-10-2009. – DopeGhoti Jul 20 '18 at 17:18 -
Ah yes, sorry, I didn’t think BSD
tar
even supportedj
, which was rather presumptive on my part. My comment only applies to GNUtar
. – Stephen Kitt Jul 20 '18 at 18:02