2016-02-22 16:50:05 -05:00
|
|
|
# 7z
|
|
|
|
|
2021-05-01 14:10:54 -04:00
|
|
|
> File archiver with a high compression ratio.
|
2023-05-18 17:13:32 +05:30
|
|
|
> More information: <https://manned.org/7z>.
|
2016-02-22 16:50:05 -05:00
|
|
|
|
2022-09-04 21:24:23 -04:00
|
|
|
- [a]dd a file or directory to a new or existing archive:
|
2016-02-22 16:50:05 -05:00
|
|
|
|
2021-05-01 14:10:54 -04:00
|
|
|
`7z a {{path/to/archive.7z}} {{path/to/file_or_directory}}`
|
2016-02-22 16:50:05 -05:00
|
|
|
|
2021-05-01 14:10:54 -04:00
|
|
|
- Encrypt an existing archive (including filenames):
|
2018-02-06 19:25:26 +01:00
|
|
|
|
2021-05-01 14:10:54 -04:00
|
|
|
`7z a {{path/to/encrypted.7z}} -p{{password}} -mhe=on {{path/to/archive.7z}}`
|
2018-02-06 19:25:26 +01:00
|
|
|
|
2021-05-01 14:10:54 -04:00
|
|
|
- E[x]tract an archive preserving the original directory structure:
|
2016-02-22 16:50:05 -05:00
|
|
|
|
2021-05-01 14:10:54 -04:00
|
|
|
`7z x {{path/to/archive.7z}}`
|
2016-02-22 16:50:05 -05:00
|
|
|
|
2021-05-01 14:10:54 -04:00
|
|
|
- E[x]tract an archive to a specific directory:
|
2018-01-18 11:41:05 +08:00
|
|
|
|
2021-05-01 14:10:54 -04:00
|
|
|
`7z x {{path/to/archive.7z}} -o{{path/to/output}}`
|
2018-01-18 11:41:05 +08:00
|
|
|
|
2022-12-04 08:53:34 +01:00
|
|
|
- E[x]tract an archive to `stdout`:
|
2019-07-28 05:05:20 -05:00
|
|
|
|
2021-05-01 14:10:54 -04:00
|
|
|
`7z x {{path/to/archive.7z}} -so`
|
2019-07-28 05:05:20 -05:00
|
|
|
|
2021-05-01 14:10:54 -04:00
|
|
|
- [a]rchive using a specific archive type:
|
2016-02-22 16:50:05 -05:00
|
|
|
|
2023-12-14 14:33:42 +01:00
|
|
|
`7z a -t{{7z|bzip2|gzip|lzip|tar|zip}} {{path/to/archive}} {{path/to/file_or_directory}}`
|
2016-02-22 20:00:13 -05:00
|
|
|
|
2021-05-01 14:10:54 -04:00
|
|
|
- [l]ist the contents of an archive:
|
2016-02-22 20:00:13 -05:00
|
|
|
|
2021-05-01 14:10:54 -04:00
|
|
|
`7z l {{path/to/archive.7z}}`
|
2016-02-22 16:50:05 -05:00
|
|
|
|
2023-11-29 21:31:42 +01:00
|
|
|
- Set the level of compression (higher means more compression, but slower):
|
2016-02-22 16:50:05 -05:00
|
|
|
|
2023-11-29 21:31:42 +01:00
|
|
|
`7z a {{path/to/archive.7z}} -mx={{0|1|3|5|7|9}} {{path/to/file_or_directory}}`
|