简体   繁体   English

zcat 不能正确解压文件

[英]zcat won't unzip files properly

I need to unzip a compressed file on the fly in my program.我需要在我的程序中即时解压缩压缩文件。 It works when I try it on my own linux computer, but for some reason the school computers fail whenever I tell them to do it.当我在我自己的 linux 计算机上尝试它时它可以工作,但由于某种原因,每当我告诉他们这样做时,学校计算机就会失败。 To unzip I'm using the following command:要解压缩,我使用以下命令:

 zcat /file/address/file.tar.gz

and get the error:并得到错误:

 /file/address/file.tar.gz.Z: No such file or directory

I tried looking through the documentation but couldn't find a flag to turn off this odd behavior.我尝试查看文档,但找不到关闭这种奇怪行为的标志。

Your school's system still has the old "compress" style utilities rather than the newer GNU "gzip" based ones.你学校的系统仍然有旧的“压缩”风格的实用程序,而不是新的基于 GNU“gzip”的实用程序。

You need to use gzcat rather than zcat , assuming that it's available.您需要使用gzcat而不是zcat ,假设它可用。

当我想gzip时,我一般只是直接使用gzip:

gzip -dc /file/address/file.tar.gz
zcat archive.tgz | tar -x --wildcards apri/fls/filename

gzip --解压 /file/address/file.tar.gz

If you ad the .Z to the end of the filename like this :如果您将 .Z 广告到文件名的末尾,如下所示:

zcat /file/address/file.tar.gz.Z zcat /文件/地址/file.tar.gz.Z

then it will find the file .然后它会找到文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM