Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the 9 mean, in -r option: zip -r9 ${OLDPWD}/package .?

Tags:

terminal

zip

Context: AWS documentation on how to create zip files for python code with dependencies, see: https://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html

I understand -r is recursion flag, but I'm unclear what the "9" in -r9 achieves?

~/my-function$ cd package
~/my-function/package$ zip -r9 ${OLDPWD}/function.zip .
  adding: PIL/ (stored 0%)
  adding: PIL/.libs/ (stored 0%)
  adding: PIL/.libs/libfreetype-7ce95de6.so.6.16.1 (deflated 65%)
  adding: PIL/.libs/libjpeg-3fe7dfc0.so.9.3.0 (deflated 72%)
  adding: PIL/.libs/liblcms2-a6801db4.so.2.0.8 (deflated 67%)
...
like image 284
user2864832 Avatar asked Sep 16 '19 22:09

user2864832


2 Answers

-r9 is a combination of the -r and -9 switches.

The switch -9 means strongest compression, on a scale from 0 to 9.

Type zip for a list of options.

like image 63
Zerte Avatar answered Jan 01 '23 08:01

Zerte


To complement @Zerte's answer, here is the output from zip --help:

  -f   freshen: only changed files  -u   update: only changed or new files
  -d   delete entries in zipfile    -m   move into zipfile (delete OS files)
  -r   recurse into directories     -j   junk (don't record) directory names
  -0   store only                   -l   convert LF to CR LF (-ll CR LF to LF)
  -1   compress faster              -9   compress better
  -q   quiet operation              -v   verbose operation/print version info
  -c   add one-line comments        -z   add zipfile comment
  -@   read names from stdin        -o   make zipfile as old as latest entry
  -x   exclude the following names  -i   include only the following names
  -F   fix zipfile (-FF try harder) -D   do not add directory entries
  -A   adjust self-extracting exe   -J   junk zipfile prefix (unzipsfx)
  -T   test zipfile integrity       -X   eXclude eXtra file attributes
  -y   store symbolic links as the link instead of the referenced file
  -e   encrypt                      -n   don't compress these suffixes
  -h2  show more help

As seen above, the -r flag results in recurse into directories

like image 25
Felipe Avatar answered Jan 01 '23 08:01

Felipe