Linux中,有了tar命令,似乎gzip,compress这些命令没有什么用了?
阿神
阿神 2017-04-17 15:03:27
0
5
786

描述问题

好像自己很少使用gzip这一类纯粹的压缩解压缩命令
更多时候在使用tar命令

虽然tar会调用相应的底层命令,但是我不关心

想知道gzip,可以用在何处

//anyway, 我知道gzip等是用于压缩解压缩 tar是用于归档(但是可以加入压缩选项, 并且100%的情况下大家都加了)

update

我说的没用:

  1. 我知道它们实际上在后台默默奉献

  2. 对于使用者(没有直接使用它们),可能没用

阿神
阿神

闭关修行中......

reply all(5)
刘奇

First of all, you have a misunderstanding. When you execute the tar zcf filename series of commands, you complete the tar merge and then call external compression such as gzip/bzip2

Using tar zcf as an example to illustrate the execution process

    The
  1. tar command is only used to merge multiple files into one file, nothing more. Once the merge is completed, tar’s work is over.

  2. Then the merged files are compressed. tar z uses gzip. Others include bzip2/xz/lzma
    . These are all compression methods, but the compression time and compression ratio are different. If you choose, it is nothing more than finding a balance between time and space.

So
tar zcf is a shortcut added by tar. Compression actually relies on external compression tools.
If there is a single file, such as when backing up a database, it needs to be compressed. Then there is no point in using tar, because individual files do not need to be merged, only gzip is required.

洪涛

tar is packaged. gzip, bzip2, etc. are compressed. Strictly follow the Unix principle of do one thing and do it well. Not a thing.

大家讲道理

tar under Linux can indeed add j, z and other parameters to package and add compression function.
This is the next rich feature of Linux.
In ancient times, tar did not have this function.

Now on aix, the function of tar is much simpler. For example, the bzip2 format is not supported.

PHPzhong

Come and see and learn

洪涛

Compressed into zip format to facilitate data processing by other operating systems.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!