本文介绍了cpio VS tar 和 cp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刚刚了解到cpio有3种模式:copy-out、copy-in和pass-through.

I just learned that cpio has three modes: copy-out, copy-in and pass-through.

我想知道 cpio 在 copy-out 和 copy-in 模式下比 tar 有什么优点和缺点.什么时候用cpio,什么时候用tar好?

I was wondering what are the advantages and disadvantages of cpio under copy-out and copy-in modes over tar. When is it better to use cpio and when to use tar?

pass-through 模式下 cpio 与 cp 的类似问题.

Similar question for cpio under pass-through mode versus cp.

谢谢和问候!

推荐答案

我认为除了翻录打开的 RPM 文件之外没有任何理由使用 cpio,通过 disrpmrpm2cpio,但在某些极端情况下,cpio 比 tar 更可取.

I see no reason to use cpio for any reason other than ripping opened RPM files, via disrpm or rpm2cpio, but there may be corner cases in which cpio is preferable to tar.

tarcpio 是在 Unix 7 版 1979 年,然后包含在 POSIX.1-1988 中,不过下一个标准 POSIX.1-2001.

Both tar and cpio are competing archive formats that were introduced in Version 7 Unix in 1979 and then included in POSIX.1-1988, though only tar remained in the next standard, POSIX.1-2001.

Cpio 的文件格式已多次更改,并且版本之间并未完全兼容.例如,现在有二进制文件信息数据的 ASCII 编码表示.

Cpio's file format has changed several times and has not remained fully compatible between versions. For example, there is now an ASCII-encoded representation of binary file information data.

Tar 更广为人知,多年来变得更加通用,并且更有可能在给定系统上得到支持.cpio 仍在少数领域使用,例如 Red Hat 软件包 格式 (RPM),不过RPM v5(这是公认的晦涩)使用 xar 而不是 cpio.

Tar is more universally known, has become more versatile over the years, and is more likely to be supported on a given system. Cpio is still used in a few areas, such as the Red Hat package format (RPM), though RPM v5 (which is admittedly obscure) uses xar instead of cpio.

两者都存在于大多数类 Unix 系统上,但 tar 更为常见.以下是 Debian 的安装统计数据:

Both live on most Unix-like systems, though tar is more common. Here are Debian's install stats:

#rank  name    inst    vote    old  recent  no-files  (maintainer)
   13   tar  189206  172133   3707   13298        68  (Bdale Garbee)
   61  cpio  189028   71664  96346   20920        98  (Anibal Monsalve Salazar)

模式

Copy-out:用于创建存档,类似于 tar -pc

Modes

Copy-out: This is for archive creation, akin to tar -pc

Copy-in:用于存档提取,类似于 tar -px

Copy-in: This is for archive extraction, akin to tar -px

直通:这基本上是上述两种,类似于 tar -pc ... |tar -px 但在单个命令中(因此在微观上更快).它类似于 cp -pdr,尽管 cpio 和(尤其是)tar 都有更多的可定制性.还可以考虑 rsync -a,人们经常忘记它,因为它通常通过网络连接使用.

Pass-through: This is basically both of the above, akin to tar -pc … |tar -px but in a single command (and therefore microscopically faster). It's similar to cp -pdr, though both cpio and (especially) tar have more customizability. Also consider rsync -a, which people often forget since it's more typically used across a network connection.

我没有比较它们的性能,但我预计它们在 CPU、内存和存档大小(压缩后)方面会非常相似.

I have not compared their performance, but I expect they'll be quite similar in CPU, memory, and archive size (after compression).

这篇关于cpio VS tar 和 cp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-30 15:54