Using 7-zip
In my previous posts we discussed the installation of 7-zip link and the 7-zip File Manager link. Now it is time to take a look at the first part of the options we have when we add a file or folder to an archive.
Let us start.
Compress a file
First we need to select a file we want to compress, next right click the file (or folder). Go to the bottom of the context menu and select “Show more options”.
A new context menu opens, select 7-zip.
Another context menu opens. You see some of the options that we discussed in the 7-zip File Manager here. Let us focus on creating a new compressed file. Select “Add to archive”.
The menu to create a new archive opens. The archive can be a compressed file / folder or an encrypted file / folder.
note
You get the same menu when you are in the 7-zip File Manager and go to File > 7-zip > Add to archive or select the green cross “Add”. A file or folder has to be selected.
The “add to archive” menu.
Let us go through the options we have.
Archive format: there are several options for archive formats. But what is an archive format?
What is an archive?
An “archive” is a single file that contains multiple files and/or folders, often in a compressed format. Archiving is a common method used for packaging a collection of files and folders into one file, making it easier to store, transfer, and manage.
Packaging: archives bundle multiple files and folders into a single file. This makes it easier to transfer or share.
Compression: archives can be compressed to reduce their overall size. Compression algorithms remove redundancies to store data more efficiently.
Preservation: archives preserve the original file attributes, such as timestamps and permissions. This maintains data integrity.
Convenience: archives simplify file distribution and backup.
Encryption: some archive formats support encryption. This adds an additional layer of security. You need a password to extract the contained files.
Archive formats in 7-zip
7z: maximum compression, especially for text and executable files. Supports encryption, solid compression, multi-threading, and multi-volume archives.
BZIP2: higher compression than Gzip but slower, when better compression is needed over speed.
GZIP: moderate to high compression. Generally used for single files, fast compression and decompression. Common in Unix and Linux environments.
TAR: no compression, often used in combination with Gzip or Bzip2 for compression. Commonly used in Unix and Linux environments.
WIM: high compression, supports file-based imaging, deduplication. Often used for Windows Imaging.
XZ: high compression, popular choice to compress files as much as possible. Slower than some other formats due to its high compression. Commonly used in distributing software packages on Unix-like operating systems.
ZIP: moderate to high compression. Widely supported across different operating systems. Supports encryption and multi-threading.
Compression level
The compression level determines how much effort the program will put into compressing the files. Compression levels in 7-zip:
Store: no compression, when you want to bundle files together.
Fastest: minimal compression, when time is critical and size not.
Fast: slightly more compression, prioritizes speed over file size.
Normal: default, balances compression ratio and speed.
Maximum: better compression, takes more time. For files that are not frequently compressed and decompressed.
Ultra: best compression, significantly increases compression time and resource usage. When maximum file size reduction is required and time/resources are not a concern. To archive large files that need to be as small as possible.
Dictionary size
This parameter affects the compression ratio and the amount of memory used during the compression and decompression processes.
The dictionary size is the amount of memory that 7-Zip uses to store parts of the data being compressed. It allows the compression algorithm to identify and eliminate redundancy by referencing previously encountered data patterns.
Larger dictionary: can lead to better compression ratios for large files with repetitive data. Needs more memory and processing time.
Smaller dictionary: uses less memory and is faster but may result in a lower compression ratio.
For most uses, the default dictionary size set by 7-Zip is adequate and offers a good balance between compression efficiency and resource usage.
Large files: benefit from a larger dictionary size as there are more data patterns to exploit.
Small files: typically not benefit as much from a large dictionary size, and using the default or a smaller size is often sufficient.
Text files: often compress well with larger dictionaries due to repetitive patterns.
Binary files (images, videos): may not see significant improvement with larger dictionaries.
System resources: ensure your system has enough RAM to handle the chosen dictionary size, especially when compressing large files or using high compression settings.
CPU: higher dictionary sizes require more CPU resources during compression.
Compression levels: higher compression levels (Maximum, Ultra) generally work better with larger dictionary sizes, leveraging the extra memory to achieve better compression.
Examples of dictionary sizes
64 KB: very small files or systems with very limited memory.
1 MB – 4 MB: moderate sized files and typical system memory capacities.
16 MB – 64 MB: for large files with repetitive data patterns, requires more memory.
128 MB – 1 GB: for very large files, optimal compression, but requires substantial system memory and CPU resources.
Word size
A parameter that influences the compression process. For those interested, the LZMA (Lempel-Ziv-Markov chain Algorithm) and LZMA2 compression algorithms used by the 7z archive format.
The word size in 7-Zip refers to the size of the “dictionary entries” that the compression algorithm uses to find and match patterns in the data. It determines the maximum length of sequences that can be matched and referenced during compression.
A larger word size can improve the compression ratio. It allows longer sequences of data to be matched and compressed. This is especially effective for files with long repetitive sequences.
A smaller word size uses shorter sequences. This might be faster but less effective at compressing data with long repetitions.
Solid block size
This parameter affects the compression efficiency, especially for large collections of files. It refers to the size of the data block that 7-Zip processes as a single unit when using solid compression.
Solid compression: 7-Zip treats multiple files as a single continuous stream of data. This allows the algorithm to find repeated patterns across file boundaries, leading to better compression ratios.
Solid block size: the size of the data block in the solid archive. It defines how much data is grouped together to find redundancy and compressing it as a single block.
Impact on compression
Larger solid block size: improves the compression ratio because it allows the compressor to find more repeated patterns across a larger dataset. However, it requires more memory during compression and decompression.
Smaller solid block size: faster compression and decompression with lower memory usage but may result in a lower compression ratio since the compressor has less data to work with at a time.
Number of CPU Threads
This setting determines how many CPU cores, or threads, the program will use during the compression and decompression processes. This can significantly affect the speed and efficiency of these operations.
CPU threads: modern CPUs have multiple cores and threads that can perform tasks simultaneously. This specifies how many of these threads are used for compression and decompression.
Multithreading: using multiple threads allows for parallel processing, speeding up the compression and decompression tasks.
Impact on performance:
Increased speed: using more CPU threads increases the speed of compression and decompression. This is particularly beneficial for large files or archives.
Resource utilization: higher thread counts use more CPU resources, can be beneficial if you have a multi-core processor.
By default, 7-Zip typically uses all available CPU threads. However, this can be adjusted based on user preferences and system capabilities.
CPU cores and threads: check how many cores and threads your CPU supports. For example, a quad-core CPU with hyper-threading might support 8 threads.
System load: if you are running other CPU-intensive applications, you might want to reduce the number of threads used by 7-Zip to avoid performance degradation.
This brings us to the end of my post on using 7-Zip.
You can find the remaining part of 7-zip “add to archive” here.
Thank you for taking the time to read my post on using 7-Zip.
I hope you found it enjoyable and insightful.
Stay tuned for more content that is coming soon.
If you like what you read, please consider sharing it with others who might find it helpful.
Disclaimer
All tips and methods mentioned in this blog are tested on Windows 11. Please note that results may vary on other operating systems or versions of Windows. Adapt the instructions accordingly.
Copyright
© 2024 Henny Staas/safecomputer.org. Unauthorized use and/or duplication of this material without express and written permission from this site’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to Henny Staas/safecomputer.org with appropriate and specific direction to the original content.