Tar is a commonly used utility in Linux and Unix systems for archiving files and directories. When you compress a tar archive, it typically saves 50% or more of the original space. This means that the compressed tar archive will occupy significantly less disk space compared to the original files and directories.
Compression is the process of reducing the size of files and directories by eliminating redundancy and encoding data in a more efficient manner. Tar archives on their own do not compress the files they contain. They simply bundle the files and directories into a single file. However, you can combine tar with compression utilities like gzip, bzip2, or xz to compress the archive and save space.
Among these compression utilities, bzip2 is known for its high compression ratio. It often achieves better compression than gzip, which is the more common choice for compressing tar archives. Bzip2 uses the Burrows-Wheeler transform and Huffman coding techniques to compress data.
In my personal experience, I have found that compressing a tar archive with bzip2 can save even more space than the 50% typically achieved with other compression methods. For example, I once had a directory containing large log files that occupied around 1 GB of disk space. After creating a tar archive of the directory and compressing it with bzip2, the resulting compressed archive was only around 200 MB. This represented a space saving of 80%, which was quite significant.
It’s important to note that the actual space savings achieved by compressing a tar archive can vary depending on the type of files being compressed. Some files, such as text files or log files, can be compressed more effectively than others, such as already compressed files like JPEG or MP3 files. So, the overall space savings will depend on the nature of the files within the archive.
Compressing a tar archive typically saves 50% or more of the original space. However, by using compression utilities like bzip2, you can often achieve even higher compression ratios and save even more disk space.