Reputation: 9918
What is the difference between Archiving and compression in Linux?
We have different commands for both which we can combine too.. but what exactly are they?
Upvotes: 17
Views: 11689
Reputation: 25
Archive:
Compress:
Upvotes: 0
Reputation: 11120
Compression is a process of taking some input data, and by using some sophisticated algorithm, compressing it (transform the bits, effectively), in order to have the same entity that weighs less size.
This is useful if you want to keep more data in a less space (space is always limited resource), or if you just want to have a faster file-transfer throughout networks.
Popular compression utility programs, on Linux distributions, are:
gzip (frequently used);
bzip2 (less frequently used, yet produces smaller output file than gzip);
xz (most space-efficient tool, in Linux, so far)
zip (often used for decompressing data, that was compressed on other systems using zip
, like Windows OS).
Note, that generally, more efficient compression method is, more time it takes.
Archiving, on the other hand, can be thought of like putting some different files into one box. If you have 5 files, each of a size of 10kb, archiving those will give you 5 x 10 = 50kb, and that is it.
Note, that on Linux, we have a very good program tar, which, when given an input, does both:
Upvotes: 2
Reputation: 316
Archiving means that you take 10 files and combine them into one file, with no difference in size. If you start with 10 100KB files and archive them, the resulting single file is 1000KB. On the other hand, if you compress those 10 files, you might find that the resulting files range from only a few kilobytes to close to the original size of 100KB, depending upon the original file type. (source)
Upvotes: 19