7z is an open-source compression software that provides an extremely high compression ratio. It can compress and decompress various file formats, including 7z, XZ, BZIP2, GZIP, TAR, ZIP, and WIM. The software is available for multiple platforms, including Linux, Windows, and macOS.
Overview
The basic syntax of the 7z command is:
7z [options] [archive-name] [file(s)]
Examples
To compress a file or directory using 7z, use the following command:
7z a [archive-name].7z [file(s)]
For example, to compress a directory named mydir
to an archive named mydir.7z
, use the following command:
7z a mydir.7z mydir/
To extract the contents of a 7z archive, use the following command:
7z x [archive-name].7z
For example, to extract the contents of an archive named mydir.7z
, use the following command:
7z x mydir.7z
Specific use cases
- Compressing large files or directories to save disk space or transfer files over the internet.
- Archiving files for backup purposes.
- Compressing files for distribution.
Options
The following table lists the available options for the 7z command:
Option | Description |
---|---|
a | Add files to archive. |
d | Delete files from archive. |
e | Extract files from archive (without using directory names). |
l | List contents of archive. |
t | Test integrity of archive. |
u | Update files in archive. |
x | Extract files with full path. |
-p | Set password. |
-m | Set compression method. |
-o | Set output directory. |
Troubleshooting tips
- If you encounter an error while compressing or extracting files, make sure that you have sufficient disk space and that the file or directory you are trying to compress or extract is not currently in use.
- If you forget the password for an encrypted archive, there is no way to recover the data. Make sure to keep a backup of the password or use a password manager.
Notes
- 7z provides a higher compression ratio than most other compression software, making it a good choice for compressing large files or directories.
- 7z supports encryption with AES-256, providing secure compression and decompression of files.
- 7z is an open-source software and is available for free.