Compressing files, or zipping files is not complex at all, however, when you are trying to do it from the command line it can be tricky to remember how to do it properly. So here is a quick and easy tutorial and how to zip the proper way!
Zip Flags
The command that you would use in the command line (bash) on Mac OS X would be “zip.” But one of the most imporant aspects is what flags to use.
Here is a list of the most important flags:
- -f freshens: use only changed files
- -u Update: Only changed or new files
- -r recurse into directories
- -e Encrypt
- -T test zipfile's integrity
- -9 Compress better
- -m MOVE into zip file (deleting OS files)
Actual implementation of ZIP in the command line
# zip -flags {file_name} {directory or file to zip}
# For example
zip -r myzip.zip ~/Desktop/test-directory/
Hope that is helpful! Until the next time —happy zipping!