如何在不解压缩的情况下检查 Unix .tar.gz 文件是否是有效文件? [英] How to check if a Unix .tar.gz file is a valid file without uncompressing?

查看:49
本文介绍了如何在不解压缩的情况下检查 Unix .tar.gz 文件是否是有效文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现了问题如何确定数据是否为没有文件的有效 tar 文件?,但我想知道:有现成的命令行解决方案吗?

I have found the question How to determine if data is valid tar file without a file?, but I was wondering: is there a ready made command line solution?

推荐答案

只获取 tarball 列表并丢弃输出,而不是解压缩文件怎么样?

What about just getting a listing of the tarball and throw away the output, rather than decompressing the file?

tar -tzf my_tar.tar.gz >/dev/null

根据评论编辑.谢谢 zrajm!

根据评论进行编辑.感谢 Frozen Flame! 此测试绝不意味着数据的完整性.因为它被设计为磁带存档实用程序,所以大多数 tar 实现将允许同一文件的多个副本!

Edit as per comment. Thanks Frozen Flame! This test in no way implies integrity of the data. Because it was designed as a tape archival utility most implementations of tar will allow multiple copies of the same file!

这篇关于如何在不解压缩的情况下检查 Unix .tar.gz 文件是否是有效文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆