linux – 有没有快速的方法来获取大型TAR中的最后一个文件?

让我们假设我有一个几千兆字节的tar文件,但我也碰巧知道写入存档的最后一个文件是我需要的重要内容.由于tar文件是按顺序附加的,有没有一种方法可以让tar从末尾读入存档以查找此文件,而不是从头开始读取数十亿字节的无关数据?

解决方法

不,不幸的是没有.从 Wikipedia

Another weakness of the tar format compared to other archive formats is that there is no centralized location for the information about the contents of the file (a “table of contents” of sorts). So to list the names of the files that are in the archive,one must read through the entire archive and look for places where files start. Also,to extract one small file from the archive,instead of being able to lookup the offset in a table and go directly to that location,like other archive formats,with tar,one has to read through the entire archive,looking for the place where the desired file starts. For large tar archives,this causes a big performance penalty,making tar archives unsuitable for situations that often require random access of individual files.

相关文章

Linux中的ARP防火墙主要用于防御ARP欺骗攻击,其效果取决于多...
insmod和modprobe加-f参数导致Invalid module format错误 这...
将ArchLinux安装到U盘 几个月前入门Arch的时候上网搜了不少安...
1、安装Apache。 1)执行如下命令,安装Apache服务及其扩展包...
一、先说一下用ansible批量采集机器信息的实现办法: 1、先把...
安装配置 1. 安装vsftpd 检查是否安装了vsftpd # rpm -qa | ...