can't untar a complete directory using tar -cvpzf

◇◆丶佛笑我妖孽 提交于 2020-01-04 02:47:13

问题


Banging my head on this one...

I used tar -cvpzf file.tar.gz to compress a complete directory.

I move the file to another server and i try to decompress the directory where i have copied the archive. Can't make it work.

bash-3.2$ tar -xvpzf news.tar.gz .       
tar: gzip: Cannot exec: No such file or directory
tar: Error is not recoverable: exiting now
tar: Child returned status 2
tar: .: Not found in archive
tar: Error exit delayed from previous errors

Anyone ?


回答1:


Your tar can't find gzip. If you don't have gzip, you can't make a .gz file. You should look for a gzip executable on your system. What kind of system is it?

In the meantime, you could leave off the "z" and just transfer a .tar file. It will be bigger, but at least you'll be able to move your data to the other server.




回答2:


Gzip was not installed on this server (VPS). I should have check this part first instead of relying on assumption.

Lessons learn




回答3:


install bzip2 and then it should be working. for example in debian/ubuntu

sudo apt-get install bzip2

or in gentoo

emerge bzip2



回答4:


Install gzip, for example ubuntu-

apt-get install gzip

Then untar it -

tar -xzf file.tar.gz




回答5:


if your directory name is "file/" you create a tar.gz using

tar -cvzpf file.tar.gz file/

then untar it using

tar -xvf file.tar.gz


来源:https://stackoverflow.com/questions/9749466/cant-untar-a-complete-directory-using-tar-cvpzf

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!