KawaiKx
KawaiKx

Reputation: 9918

Difference between archiving and compression

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

Answers (3)

Karthee Kumar Vanama
Karthee Kumar Vanama

Reputation: 25

Archive:

  • An archive file is a collection of files and directories stored in one file.
  • The archive file is not compressed — it uses the same amount of disk space as all the individual files and directories combined.

Compress:

  • A compressed file is a collection of files and directories that are stored in one file and stored in a way that uses less disk space than all the individual files and directories combined.
  • If disk space is a concern, compress rarely-used files, or place all such files in a single archive file and compress it.

Source Url

Upvotes: 0

Giorgi Tsiklauri
Giorgi Tsiklauri

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:

  1. archives the input (first step);
  2. and then compresses that archive.

Upvotes: 2

Djamel F.
Djamel F.

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

Related Questions