Ubuntu : This does not look like a tar archive

3

1

I am trying to run the following command after I have downloaded a tar file using the sudo wget command to install CasperJS on our Ubuntu box.

sudo tar -xvf casperjs.tar

This does not look like a tar archive
Skipping to next header
Exiting with failure status due to previous errors

Do I need to run the original sudo tar command differently?

Zabs

Posted 2013-11-08T10:04:23.470

Reputation: 181

1What commands/url/file did you use for wget. A downloaded tar is normally compressed like a .tgz or .gz. (I seldom see an uncompressed .tar file online) – Rik – 2013-11-08T10:09:42.163

The command was :- sudo wget -O casperjs.tar https://github.com/n1k0/casperjs/tarball/1.0.0

– Zabs – 2013-11-08T10:11:03.120

By the way why do you add sudo in front of all commands? From the security point of view you certainly should not run Internet clients (wget) as a superuser. – pabouk – 2013-11-08T11:10:54.220

For future reference: There is a nice command named file. If I use file demo.tgz I get a demo.tgz: gzip compressed data, from Unix, last modified: Fri Nov 8 13:31:16 2013. Running file on a plain tar file returns: 'demo.tar: POSIX tar archive'. – Hennes – 2013-11-08T12:33:10.057

Answers

2

to see what you got:

file casperjs.tar

and then to see its content, if it IS a tar file:

tar tvf casperjs.tar
tar tvzf casperjs.tar  #if that was a gzip-ed tar file
tar tvbf casperjs.tar  #if that was a bzip-ed tar file
tar tvZf casperjs.tar  #if that was a compress-ed tar file  #now very unlikely...
 #note that after the 'f', you need to have a SEPARATOR (space, or tab) followed by the FILENAME. 
 #ie, you can't place an option after the f
 #ex: "tar tvfz something.tar.gz", would try to open file "z" instead and find "something.tar.gz" inside it...

then change the 't' into 'x' to extract (I recommend to first use 't', though...)

Olivier Dulac

Posted 2013-11-08T10:04:23.470

Reputation: 818

When I run the command file casperjs.tar it states "Zip archive data, at least v1.0 to extract" – Zabs – 2013-11-08T10:27:54.213

@Zabs: I believe Rik tried to download it and found it out to be a gzip'ed tar. If so, it would be : tar xvzf casperjs.tar. However, if it really a zip (instead of gzip) file : mv casperjs.tar casperjs.tar.zip ; unzip casperjs.tar.zip and then untar the extracted tar file[s]. – Olivier Dulac – 2013-11-08T11:09:39.640

3

The file you downloaded was a .tar.gz. (A compressed .tar file)

You can use

tar -zxvf casperjs.tar

But actually you should have downloaded it as a .tgz like this:

sudo wget -O casperjs.tar github.com/n1k0/casperjs/tarball/1.0.0 –O casperjc.tgz
sudo tar -zxvf casperjs.tgz

The -z stands for:

-z, --gzip, --ungzip filter the archive through gzip

Rik

Posted 2013-11-08T10:04:23.470

Reputation: 11 800