Tuesday, March 7, 2017

I need help extracting a tar.gz file




I recently compressed a tar.gz file and thought that I can compress it down further by compressing the tar.gz file into a new one.



What I ran to compress it:



tar -czvf world.tar.gz world/


Then I did:



tar -czvf world.tar.gz world.tar.gz



Now I cannot extract it using the normal command because it gives this error:



gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now


The command to decompress tar.gz file is:




tar xzvf filename.tar.gz


Since in your case the original filename and the compressed filename are the same, you can't decompress the file in the same directory you have the compressed file (as it will override it).



Try the following:




  • make a new dir in /tmp


  • copy the tar.gz to that directory

  • change directory to /tmp

  • decompress the file to /tmp



The commands:



mkdir /tmp/myfolder
cp world.tar.gz /tmp/myfolder


cd /tmp
tar xzvf /tmp/myfolder/world.tar.gz


Note: You can run the file command in order to check if the file is actually a tar.gz file



file filename.tar.gz

No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...