2014-01-28 07:47:32 +00:00
|
|
|
# zip
|
|
|
|
|
2024-03-14 05:01:06 +00:00
|
|
|
> Package and compress (archive) files into a Zip archive.
|
2022-07-06 21:47:47 +01:00
|
|
|
> See also: `unzip`.
|
2021-09-01 20:08:03 +01:00
|
|
|
> More information: <https://manned.org/zip>.
|
2014-01-28 07:47:32 +00:00
|
|
|
|
2022-10-18 16:10:34 +01:00
|
|
|
- Add files/directories to a specific archive ([r]ecursively):
|
2016-09-01 16:41:00 +01:00
|
|
|
|
2022-07-06 21:47:47 +01:00
|
|
|
`zip -r {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
|
2016-09-01 16:41:00 +01:00
|
|
|
|
2022-10-18 16:10:34 +01:00
|
|
|
- Remove files/directories from a specific archive ([d]elete):
|
2016-09-01 16:41:00 +01:00
|
|
|
|
2022-07-06 21:47:47 +01:00
|
|
|
`zip -d {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
|
2016-09-01 16:41:00 +01:00
|
|
|
|
2022-07-06 21:47:47 +01:00
|
|
|
- Archive files/directories e[x]cluding specified ones:
|
2017-03-01 10:12:25 +00:00
|
|
|
|
2022-10-18 16:10:34 +01:00
|
|
|
`zip -r {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}} -x {{path/to/excluded_files_or_directories}}`
|
2017-03-01 10:12:25 +00:00
|
|
|
|
2022-07-06 21:47:47 +01:00
|
|
|
- Archive files/directories with a specific compression level (`0` - the lowest, `9` - the highest):
|
2017-10-20 12:22:59 +01:00
|
|
|
|
2024-02-09 07:59:12 +00:00
|
|
|
`zip -r -{{0..9}} {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
|
2017-10-20 12:22:59 +01:00
|
|
|
|
2022-07-06 21:47:47 +01:00
|
|
|
- Create an [e]ncrypted archive with a specific password:
|
2015-12-28 16:51:04 +00:00
|
|
|
|
2022-07-06 21:47:47 +01:00
|
|
|
`zip -r -e {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
|
2015-12-28 16:51:04 +00:00
|
|
|
|
2024-03-14 05:01:06 +00:00
|
|
|
- Archive files/directories to a multi-part [s]plit Zip archive (e.g. 3 GB parts):
|
2015-12-28 16:51:04 +00:00
|
|
|
|
2022-07-06 21:47:47 +01:00
|
|
|
`zip -r -s {{3g}} {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
|
2018-02-09 10:52:28 +00:00
|
|
|
|
2022-07-06 21:47:47 +01:00
|
|
|
- Print a specific archive contents:
|
2018-02-09 10:52:28 +00:00
|
|
|
|
2022-07-06 21:47:47 +01:00
|
|
|
`zip -sf {{path/to/compressed.zip}}`
|