Search code examples
terminalzip

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


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%)
...

Solution

  • -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.