Linux Mint 12 - how to open a .zip file in terminal

3

The question above about covers it- I am so very sorry, I see the answers all the time but, though very explicit, I just can't apply them to my terminal.

I have a zipped folder, I can't open it in archive: I get the following error:

Archive:  /home/elansa/Music/Music.zip
Zip file size: 2011856896 bytes, number of entries: 4693

warning [/home/elansa/Music/Music.zip]:  end-of-central-directory record claims this
  is disk 176 but that the central directory starts on disk 20153; this is a
  contradiction.  Attempting to process anyway.
error [/home/elansa/Music/Music.zip]:  missing 3025939027 bytes in zipfile
  (attempting to process anyway)
error [/home/elansa/Music/Music.zip]:  start of central directory not found;
  zipfile corrupt.
  (please check that you have transferred or created the zipfile in the
  appropriate BINARY mode and that you have compiled UnZip properly)

I was reading that this kind of error could be corrected in the terminal. Is this true? if so may I have directions? I have never been able to open a zip. I don't believe I am stupid, but this just eludes me.

Any help would be greatly appreciated.

user249912

Posted 2014-01-09T18:29:51.167

Reputation: 31

Is this a .tar.gz or is it a '.zip' file? It appears to be zip but your question says .tar.gz. – Kevin Panko – 2014-01-09T18:38:28.587

Have you tried gunzip? – ScottAndrewRogers – 2014-01-09T18:44:03.110

Is there any useful output if you enter unzip -t Music.zip ? – tohuwawohu – 2014-01-09T18:52:52.690

Maybe this helps: http://superuser.com/q/23290/84724

– tohuwawohu – 2014-01-09T19:03:13.480

1Actually, what would help would be the output of file Music.zip put into the question by the original questioner. – JdeBP – 2014-01-09T19:09:45.160

Answers

5

First off, the file you have listed in your post is not a .tar.gz file. It appears to be a ZIP file. The ZIP file also looks like it is corrupted or incomplete somehow.

But to answer your question, if you did have a .tar.gz file, (lets say you have music.tar.gz in your home directory) you would extract the contents like this (this assumes you are in the same directory as the .tar.gz file)

tar -xzvf music.tar.gz

This would extract the .tar.gz archive in the current directory (your home directory)

-z : Uncompress the resulting archive with gzip command.
-x : Extract to disk from the archive.
-v : Produce verbose output i.e. show progress and file names while extracting files.
-f music.tar.gz : Read the archive from the specified file called music.tar.gz.

A few questions for you. Did you create this zip file on a Linux system or in Windows? I have seen it happen that if you create the file using WinZIP, for some strang reason the archive will show up as incomplete when you try to extract it on Linux or Mac OS X. If you created the ZIP file in Windows using WinZIP, try to open it in Windows with WinZIP and see if you can at least see a list of files contained within the archive. If you can, extract the files on Windows and use a real archive tool like 7 Zip or WinRAR to re-create the archive again.

Another option would be to use the unzip command in Linux on the command line. The syntax would be

unzip music.zip

which will extract the archive into the current folder.

Richie086

Posted 2014-01-09T18:29:51.167

Reputation: 4 299

4

This question covers repairing a corrupted zip file - terminal tool (linux) for repair corrupted zip files

Expanding a little on the answers there, you would want to do something like:

zip -F /home/elansa/Music/Music.zip --out Music_fixed.zip
unzip Music_fixed.zip

If that doesn't work try:

zip -FF /home/elansa/Music/Music.zip --out Music_fixed.zip
unzip Music_fixed.zip

According to the zip manual, it is better to try with just -F first:

The single -F is more reliable if the archive is not too much damaged, so try this option first.

Since it seems you are a beginner to the command line and I am unsure if the zip program comes installed by default on Linux Mint, here is a command to install it:

sudo apt-get install zip

Hope this helps.

Graeme

Posted 2014-01-09T18:29:51.167

Reputation: 435

zip -FF worked in my case (unzipping a windows zipped archive on os x). Thanks. – polym – 2015-06-19T21:34:56.583

3

I had this same issue with a very large ZIP file created in Windows. Running the zip tool caused the same error others have described (this is on OS X running Zip 3.0):

bash-3.2$ unzip -l Users.zip 
Archive:  Users.zip
warning [Users.zip]:  126463302015 extra bytes at beginning or within zipfile
  (attempting to process anyway)
error [Users.zip]:  start of central directory not found;
  zipfile corrupt.
  (please check that you have transferred or created the zipfile in the
  appropriate BINARY mode and that you have compiled UnZip properly)

The solution in my case was to use the p7zip package instead (http://p7zip.sourceforge.net/ or use your favorite package manager). This worked flawlessly:

bash-3.2$ 7z l Users.zip
<tons of successful output>

Someone else described this exact scenario here: http://www.linuxquestions.org/questions/linux-software-2/unzip-error-in-linux-error-zip-file-too-big-939528/.

Nick Fishman

Posted 2014-01-09T18:29:51.167

Reputation: 131

0

Perhaps it's off topic, though on top of the Graeme's answer, using -FFzf worked in my case. I was trying to unzip a 6.6G file which was probably compressed on Windows.

$ zip -v
...
This is Zip 3.0 (July 5th 2008), by Info-ZIP.
...
ZIP64_SUPPORT

$ unzip a.zip
... start of central directory not found; zipfile corrupt.

$ zip -FF a.zip --out a_fixed.zip
...
zip error: Entry too big to split, read, or write (Poor compression resulted in unexpectedly large entry - try -fz)

$ zip -FFfz a.zip --out a_fixed.zip
$ unzip a.zip

Nobu

Posted 2014-01-09T18:29:51.167

Reputation: 111