Linux: can't extract tar file- (Error: This does not look like a tar archive)

Sometimes while extracting any tar file on Linux we are getting the error like this doesn't look like a tar file or something.

I had the same issue, but after some googling i found the solution so here i want to share it with you.

I got this error on Debian
root@localhost:/etc/ha.d# gzip -dc ha.cf.gz | tar -xf -
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Exiting with failure status due to previous errors    

So in this case you can use small Linux based tool unp

what is unp ?
       unp is a one small perl script which makes extraction of any archive files a bit easier. It support several compressors and archiver programs, chooses the right one(s) automatically and extracts one or more files in one go.
       unp is a very powerful tool to unpack everything using single command.


How to use ?

To install it on debian system run below command in terminal

 root@localhost: apt-get install unp  

To install it on Fedora/CentOS

 $root@localhost: yum install unp  (rpmfusion should be installed first)   

once you have installed it just use below command to extract any files.

$root@localhost: unp file-name

unp will analyse the file and use the correct extraction command to extract given file.

Some more examples :

 unp *.tar.gz  
 unp *.tar.bz  
 unp *.rpm  
 unp *.deb  
 unp *.zip  
 unp *.rar   



For more detail about unp : http://packages.debian.org/sid/utils/unp

No comments:

Post a Comment

Pages