tldr/pages/common/7z.md

37 lines
989 B
Markdown
Raw Normal View History

2016-02-22 21:50:05 +00:00
# 7z
> File archiver with a high compression ratio.
> More information: <https://manned.org/7z>.
2016-02-22 21:50:05 +00:00
- [a]dd a file or directory to a new or existing archive:
2016-02-22 21:50:05 +00:00
`7z a {{path/to/archive.7z}} {{path/to/file_or_directory}}`
2016-02-22 21:50:05 +00:00
- Encrypt an existing archive (including filenames):
`7z a {{path/to/encrypted.7z}} -p{{password}} -mhe=on {{path/to/archive.7z}}`
- E[x]tract an archive preserving the original directory structure:
2016-02-22 21:50:05 +00:00
`7z x {{path/to/archive.7z}}`
2016-02-22 21:50:05 +00:00
- E[x]tract an archive to a specific directory:
2018-01-18 03:41:05 +00:00
`7z x {{path/to/archive.7z}} -o{{path/to/output}}`
2018-01-18 03:41:05 +00:00
- E[x]tract an archive to `stdout`:
`7z x {{path/to/archive.7z}} -so`
- [a]rchive using a specific archive type:
2016-02-22 21:50:05 +00:00
`7z a -t{{7z|bzip2|gzip|lzip|tar|zip}} {{path/to/archive.7z}} {{path/to/file_or_directory}}`
- [l]ist the contents of an archive:
`7z l {{path/to/archive.7z}}`
2016-02-22 21:50:05 +00:00
2023-11-29 20:31:42 +00:00
- Set the level of compression (higher means more compression, but slower):
2016-02-22 21:50:05 +00:00
2023-11-29 20:31:42 +00:00
`7z a {{path/to/archive.7z}} -mx={{0|1|3|5|7|9}} {{path/to/file_or_directory}}`