How do I open a ".tar.tgz" file?
March 29, 2008 5:31 AM   Subscribe

How do I open a ".tar.tgz" file? That's all one long extension.

I have a friend who's hosting package expired on So I immediately logged-in to backup his information. The problem is the backup function gives me a huge file with a .tar.tgz extension. Now I would like to take the contents of that file and upload to my own hosting service. I tried uncompressing with WinZip, WinRar, WinAce, ZipGenius, StuffIt, Gzip, GUnzip, and more! None of these programs recognize the file as a valid archive. I uploaded the file to my hosting service, and attempted to extract it from there. Same result. I also redownloaded the backup, thinking the original file may have been corrupted, but I got the exact same file down to the byte.

They seem to have disconnected the ftp access, so I can no longer access the files that way. The backup function is my only option.

So am I stuck with a proprietary file which can only be uncompressed on or is there another way to crack this nut?

posted by exolstice to Computers & Internet (21 answers total) 2 users marked this as a favorite
Usually compressed tarballs are 'tar.gz' or '.tgz', not '.tar.tgz'. Possibly the creator just typed the wrong filename when making the tarball, in that case try making a copy of the file, changing the extention to 'tar.gz', and decompressing: "tar xpfz file.tar.gz".
posted by These Premises Are Alarmed at 5:40 AM on March 29, 2008

Response by poster: Tried your suggestion. It didn't work. Also, the extension is automatically generated by the backup program. I have no control over it.
posted by exolstice at 6:02 AM on March 29, 2008

if you're on a linux or unix box, the command to unarchive that tarball is tar xzvf filename.tar.tgz

so if the file is named backup.tar.tgz then you are typing tar xzvf backup.tar.tgz

if that doesn't work, you can try running the 'file' command to see what type of data you have:
file backup.tar.tgz should report something like: backup.tar.tgz: gzip compressed data, from Unix, last modified blah blah blah.

if file reports it is a different kind of archive, respond here and we'll help you get it untarred.
posted by namewithoutwords at 6:08 AM on March 29, 2008

A .tar.gz file is created when a directory is first tar'ed then gzip'ed. A .tgz file is created when a directory is tar'ed and gzip'ed in one command -- .tgz is the equivalent of .tar.gz -- so file.tar.tgz is equivalent to file.tar.tar.gz. If you have access to a Unix-like system (including a Mac), you should be able to use the command that These Premises Are Alarmed suggested, but trying renaming the file to "file.tar.tar.gz". Or gunzip, untar (using "tar xpf") , and untar again.

In Windows I have no problem using WinRAR to deal with a proper .tar.gz file or a .tar.tgz file.

If none of this works, perhaps your FTP session was in ASCII mode instead of binary mode, which would have resulted in potential loss (so-to-speak) of data that was encoded in this archive file. In that case, you're probably out of luck.

If you're on a Unix-like system, try posting the results of these commands, and we might have more help for you.

On preview: what namewithoutwords said, run the command "file" on your archive file (i.e., if your file is named backup.tar.tgz, type "file backup.tar.tgz" to see what kind of a file the system thinks it is, and let us know.
posted by ellenaim at 6:15 AM on March 29, 2008

"tgz" is usually an abbreviation for .tar.gz, a gzipped tarball. But, tar.tar doesn't make any sense, as a tarball is a container, and the second tar seems to name the contents of the container as a scalar value, which is /weird./

I'd try one layer at a time.

- rename to .tar.tar.gz
- "gunzip" it to get ...tar
- "tar x" it to get some number of files

Then, see what you get.

If you make no progress, then finally I'd boot with an Ubuntu try/install CD, which has programs that are native for those sorts of files. Note that "file" command, which inspects the beginning of a file and guesses at what it is.

Here's an example of what you'd do:

cmiller@zippy:~/Desktop $ file fixedpatches.tar.gz
fixedpatches.tar.gz: gzip compressed data, was "fixedpatches.tar", from Unix, last modified: Wed Mar 28 11:38:25 2007
cmiller@zippy:~/Desktop $ gunzip fixedpatches.tar.gz
cmiller@zippy:~/Desktop $ file fixedpatches.tar
fixedpatches.tar: POSIX tar archive (GNU)
cmiller@zippy:~/Desktop $ tar xf fixedpatches.tar

At least then, you can figure out what you're dealing with and learn how to use it in the future.

You can download an Ubuntu CD image for free.
posted by cmiller at 6:20 AM on March 29, 2008

Ditto the file command. If you don't already have access to a Unix system, installing Cygwin on Windows will be a lot easier and faster than downloading and burning an Ubuntu CD.
posted by grouse at 6:22 AM on March 29, 2008

7-Zip! I'm on my mac, so I can't be exactly sure, but usually after you install it, you can right-click on the file and get a 7-zip sub-menu. "Extract files here" or something similar should pop it right open. Usually it's then going to turn it into yourfilename.tar, just repeat the process until you get actual normal files. :)
posted by epersonae at 7:11 AM on March 29, 2008

Some background theory:
Back in the day when people backed up their computers to tape, it was useful to combine a bunch of files into a single file. The format used to do that was called "tar" (tape archive). This format didn't do any compression, it just basically laid all the files end - to - end.

Then people decided they wanted compression. Because they already had a handy way to group files together, they created compress, then evolved into gzip. That added the .gz file extension.

So if you first tar, then gzip the tar, you end up with a file.tar.gz. People decided that was too long, so shortened it to .tgz in some cases. You see both formats of naming quite often.

What throws me about your file is it has both .tar, and .tgz. That implies that tar was run twice which is silly. It's probably just misnamed.

To get at it on windows, I'd download GnuWin32's ports of gzip and tar. Then on the windows command line, run:
mv file.tar.tgz file.tar.gz
gunzip file.tar.gz
tar -xvf file.tar (xvf stands for eXtract, Verbose, File)

Good luck.
posted by cschneid at 7:48 AM on March 29, 2008

Everyone's nailed the .tgz, so I'll float another idea...

How did you download this? If via FTP, were you in binary mode? Downloading a compressed archive in ASCII mode may well leave you with a file full of gibberish, and if your friend did the same thing, he's have a bit-for-bit copy of the same gibberish you do. (If via HTTP, disregard this suggestion entirely.)
posted by fogster at 8:16 AM on March 29, 2008

If you don't have a linux machine handy, you can install unxutils on windows. It'll be faster/easier than installing cygwin, and it contains file, tar and gzip.
posted by swapspace at 12:16 PM on March 29, 2008

I agree with epersonae about 7-Zip. It works much the same on Windows. I don't think it recognizes .tgz but it does do .tar and .gz so, as other have said, rename .tgz to .tar.gz. Run it once to get a single .tar file and then again to get the individual files. If that doesn't work then something weird has happened. Perhaps the FTP issue cschneid mentioned. Unfortunately you're really out of luck if that happened.
posted by tetranz at 1:13 PM on March 29, 2008

Response by poster: I tried all those command line tools in the links. They all tell me that it isn't a gzip archive, or a tar archive. I tried renaming the file to all the aforementioned combinations of .tar and .gz. It still get the same result. I didn't try the Unix stuff, I know very little about it.

If anyone wants to take a crack at opening it just send me a message by email (profile) and I'll email you the link. I have the file hosted on my server, thanks.
posted by exolstice at 1:43 PM on March 29, 2008

I took a look at your file and tried processing it with tar, unzip, gunzip, bunzip2, and 7zip. The file does not appear to be a valid archive of any of these types.

The file seems to contain mostly binary data, but the word "dummy" appears, ascii-encoded, in the first line of the file, as shown by the command:

% head -1 filename.tar.tgz | strings

Also, the last line of the file seems to contain a fairly long hexadecimal string:

% tail -1 filename.tar.tgz | strings

I'm not entirely sure what to make of that; I don't know of an archive format that has the text "dummy" at its beginning, nor am I familiar with that hex checksum(?) at the end...
posted by Juffo-Wup at 5:19 PM on March 29, 2008

epersonae is right, 7-zip can natively open up tar files. It's also great at opening just about any other archive file in the world too.
posted by Geppp at 6:05 PM on March 29, 2008

Response by poster: I download the file using the backup function from the hosting service (via http web based application). I guess they use their own proprietary file format.

Thanks for all the help!
posted by exolstice at 8:23 PM on March 29, 2008

gzip -dc filename | tar xvf -
posted by hardcode at 1:41 AM on March 30, 2008

hardcore: that would work for a tgz or tar.gz file, but not this.
posted by Pronoiac at 12:38 PM on March 30, 2008

For anyone wondering, the file command just calls the file "data."

A quick attempt compression with lzop suggests that it's probably compressed already. I can add lzop, unrar, & shar to the list of things it's not. I'm going to toss unix2dos & dos2unix to see if an ascii/binary translation botched this up.
posted by Pronoiac at 5:54 PM on March 30, 2008

Best answer: I've got it! It had an extra byte at the start of the file - it looks like a space.

Fix it with "dd bs=1 skip=1"

Note: this will be a very slow command, as dd is very non-optimal on bytes instead of blocks. It will be CPU-bound, not I/O-bound, so the hard drive light won't stay lit or anything.

Huh. It looks like that would take about 100 minutes. How about: "tail --bytes=570705935 >" - that takes under a minute.

So, it's a .tar.gz file. gzip decompresses that okay, tar gets down to var/yp/, & there's some noise about trailing garbage which I doubt is important.
posted by Pronoiac at 6:18 PM on March 30, 2008

Bingo Pronoiac! I was trying to match magic ids of gz/bz2/tar etc. in the text and hit it just after the first space - 1F 8B 08. Magic id info courtesy

Just removing the space does the trick.
posted by swapspace at 9:24 PM on March 30, 2008

Response by poster: IT WORKED! Thanks for all the help. It was much appreciated.
posted by exolstice at 4:34 AM on March 31, 2008

« Older It's not a wad of gum, what else could it be?   |   Microphone and amp for vocal practice Newer »
This thread is closed to new comments.