Home  >  Q&A  >  body text

Linux中,有了tar命令,似乎gzip,compress这些命令没有什么用了?

描述问题

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

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

想知道gzip,可以用在何处

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

update

我说的没用:

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

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

阿神阿神2730 days ago788

reply all(5)I'll reply

  • 怪我咯

    怪我咯2017-04-17 15:05:27

    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.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 15:05:27

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

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 15:05:27

    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.

    reply
    0
  • PHPz

    PHPz2017-04-17 15:05:27

    Come and see and learn

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 15:05:27

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

    reply
    0
  • Cancelreply