How to work with zip archives This note was created on 2020-06-04 This note was last edited on 2023-01-31 zip is a popular archive file format that supports lossless data compression. A ".zip" file may contain one or more files or directories. "zip" utility is used to compress file(s) and "unzip" to extract. === Usage === Create a ".zip" archive from file(s): $ zip archive.zip file1 file2 Use "-m" to delete source file(s). Use "-r" to compress folder(s). Use "-e" to encrypt archive. Create a ".zip" archive from file, while specifying the compression level (1 being worst, 9 best, and 6 default). For example, level 7: $ zip -7 archive.zip file1 Extract file(s) from archive: $ unzip archive.zip Extract file(s) to specific directory: $ unzip archive.zip -d /home/$USER/Documents Extract file(s) from archive to stdout: $ unzip -p archive.zip List all files in "archive.zip": $ unzip -l archive.zip Use "-v" for verbose output. Add file(s) to archive: $ zip -u archive.zip file3 file4 Remove file(s) from archive: $ zip -d archive.zip file4 Test compressed archive data: $ unzip -t archive.zip