T
T
Thiago Alvarez2019-08-30 20:16:04
linux
Thiago Alvarez, 2019-08-30 20:16:04

Archiving and compression in Linux?

Why do you need to archive files at all?
I used to think that you need to archive with tar in order to collect all the files into one file, and it’s already convenient to compress them later.
But you can immediately compress many files at once with one command, without archiving.
Enlighten plz

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Saboteur, 2019-08-31
@thiago_alvarez

tar was originally made for packing files and directories into a tape archive (in a single stream).
gzip is a stream archiver, it doesn't know about files, it packs a stream. On the run. Fast. It does not parse the entire file, so the algorithm that is used in gzip is now used almost everywhere (in modems, network cards, and so on).
historically, tar+gzip was used to compress multiple files, which has become the de facto standard.
In today's world, a standard is more important than a few percent compression, so .tgz is a very popular and reliable solution that will work on any Linux. But zip is not everywhere. You apparently have not come across cut-down versions of Linux in embedded, and even in RHEL7 it is not included in the standard delivery, you must install it separately.
And finally - tar can store posix permissions, but zip or rar cannot. Therefore, the .tgz format will remain with us for a long time.

P
pfg21, 2019-08-30
@pfg21

compression without archiving is less efficient, although easier to access.
for a cold backup or batching of data, it is more convenient to keep everything in one set.
it's a pity that tar and cpio don't have a file index.
you need to dig into rar5, it seems * nix file attributes were brought there.

R
Ronald McDonald, 2019-08-30
@Zoominger

What is the problem with one command to archive in tar, and then in gzip or bzip2?
For example.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question