Archiving and compressing with zip
ZIP is a popular compressed archive format available on Linux, Mac, and Windows. It isn't as commonly used as gzip or bzip2 on Linux but is useful when distributing data to other platforms.
How to do it...
- The following syntax creates a zip archive:
$ zip archive_name.zip file1 file2 file3...Consider this example:
$ zip file.zip fileHere, the file.zip file will be produced.
- The
-rflag will archive folders recursively:
$ zip -r archive.zip folder1 folder2- The
unzipcommand will extract files and folders from a ZIP file:
$ unzip file.zipThe unzip command extracts the contents without removing the archive (unlike unlzma or gunzip).
- The
-uflag updates files in the archive with newer files:
$ zip file.zip -u newfile- The
-dflag deletes one or more files from a zipped archive:
$ zip -d arc.zip file.txt- The
-lflag to unzip lists the files in an archive:
$ unzip -l archive.zipHow it works...
While being similar to most of the archiving and compression...