Unable to unzip .zip file on linux machine - amazon-web-services

I have a large ~10GB zip file that was created using the standard Windows method (right click, select "send to compressed (zipped) folder"). I am able to unzip it just file on my Macbook.
I'm trying to unzip it on an EC2 machine. I know the file is a zip file because when I run file file.zip it says:
file.zip: Zip archive data, at least v2.0 to extract
Running unzip returns the following error:
Archive: file.zip
warning [file.zip]: 3082769992 extra bytes at beginning or within zipfile
(attempting to process anyway)
error [file.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)
Running tar xvf file.zip returns the following:
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Archive contains `<{\204\027\333"D\344\210\321o\331' where numeric off_t value expected
tar: Archive contains `S\354\202},F\3546\276[\265\273' where numeric time_t value expected
tar: Archive contains ``3c\254\372$:e' where numeric uid_t value expected
tar: Archive contains `\265\306\025+ÜĞL\352' where numeric gid_t value expected
...etc
Does anyone know what might be going wrong?

Actually, 7-zip should makes this well, you can install it by:
sudo apt-get install p7zip-full
Then, you can extract your zip file as follows:
7z e file.zip

If your zip archive has 88,000 files and you are dealing with ~10Gig of content, you will need an unzip program that supports the zip64 extension.
You can check if your unzip program supports zip64 like this
$ unzip -v | grep -i zip64
ZIP64_SUPPORT (archives using Zip64 for large files supported)
If it doesn't have ZIP64_SUPPORT, you are out of luck. I suspect your unzip doesn't support zip64.
Alternatives are to get a version of unzip that does support zip64 or use an alternative program, like z-zip.

Your Entire File did not zip most probably and you prematurely moved it. At Least that was the issue with me.

I was unable to install 7z on my machine due to no sudo access, but I managed to repair the archive using
zip -FF archive.zip --out archive_repaired.zip -fz
and unzip worked on the repaired archive.
I found the solution via this github issue

Related

compress list of files and directories with brotli

I'd like to use brotli to compress a list of files and directories. I'm able to do this with zip running
zip -r archive.zip *
and I'm looking for a similar command with brotli. I've tried
tar -cf archive.gz * && \
brotli -n -q 11 -o archive.zip archive.gz
but after decompression the zip doesn't have the same structure than with zip.
Your second command is actually right. Brotli, like Gzip/Bzip2/etc can only compress a single file.
What you must do is first package all of your files in a tarball:
tar -cvf output.tar /path/to/dir
And then compress the resulting tarball with Brotli:
brotli -j -Z output.tar
Which should leave you with a output.tar.br file (similar to *.tar.gz gzipped tarballs).
Have you tried Brotli-cli?
This comes with a lot of options to get files compressed using Brotli
you can try creating a .tar file instead of .gz

tar compressing and decompressing

I am working on iMX6 Arm processor based hardware platform with embedded linux. I am using the tar command to compress a directory containing 3 files. When I try to decompress the folder to get back the three files I am facing different issues:
I get one or two files after decompressing.
The data in the original file and the decompressed file, there is data mismatch.
I am using these commands to create and decompress the tar file:
nohup tar -zcpf /home/root/upload_new_U1/unit1-`(date +%Y%m%d_%H-00)`.tar.gz upload_now_U1
tar -zxpf unit1-`(date +%Y%m%d_%H-00)`.tar.gz
Please help.

./configure step in Installing qt

I am trying to install Qt on my Ubuntu Linux for using its libraries in reading XML files. I downloaded it from Qt Submodules and started to install step by step according the instruction in the Qt for Linux/X11 - Building from Source web page.
Things when well until I issued ./configure at the step 3. Then this error is appeared:
bash: ./configure: No such file or directory
These are my code lines:
cd /tmp
gunzip qt-everywhere-opensource-src-%VERSION%.tar.gz # uncompress the archive
tar xvf qt-everywhere-opensource-src-%VERSION%.tar # unpack it
cd /tmp/qt-everywhere-opensource-src-%VERSION%
./configure
I am confused that what should I do? I can not find configure...
Thanks in advance for your helpful answers.
From the official website:
If you download a Zip source package, you will need to convert Windows-style line endings (CR/LF) to Unix-style line-endings (LF) when you uncompress the package. To do this, give the "-a" option when you run the "unzip' command.If you fail to supply the "-a" option when unzipping the package, you will see the following error message when you attempt to execute the configure command: "bash: ./configure: /bin/sh^M: bad interpreter: No such file or directory"
So be sure to supply the -a option when uzipping
Take a look at this link: http://www.stackoverflow.com/questions/2920416/configure-bin-shm-bad-interpreter
For those who came into this question with same answer, but for Qt5..
From the official website:
If you download a Zip source package, you will need to convert
Windows-style line endings (CR/LF) to Unix-style line-endings (LF)
when you uncompress the package. To do this, give the "-a" option when
you run the "unzip' command.If you fail to supply the "-a" option when
unzipping the package, you will see the following error message when
you attempt to execute the configure command: "bash: ./configure:
/bin/sh^M: bad interpreter: No such file or directory"
So be sure to supply the -a option when uzipping Take a look at this
link:
http://www.stackoverflow.com/questions/2920416/configure-bin-shm-bad-interpreter
This answer does not work anymore, becouse all files in zip archive are tagged as binary (even configure text files). Only way to make it work is download xxx.tar.xz file, and open it by tar -xf xxx.tar.xz. If TAR.XZ file is not recognized, use -J parameter (tar -xJf xxx.tar.xz).

SSH command gets terminated while compressing a directory

I am compressing a big directory about 50GB containing files and folder using putty SSH COMMAND LINE.i am using this command:
tar czspf file.tar.gz directory/
it starts work fine, but after some time it gets terminated with single word message "Terminated" and compression stopped near about 16GB of tar archive.
Is there any way to escape from terminated error or how to deal this problem, or any other method to make a tar of directory avoiding the terminate error.Thanks
Probably you conflict with some kind of file size limit. Not all file system supports very big files. In this case you could pipe the output of the tar into a split command like this:
tar czsp directory/|split -b4G fileprefix-

Tarring only the files of a directory

If I have a folder with a bunch of images, how can I tar ONLY the images and not the folder structure leading to the images without having to CD into the directory of images?
tar czf images.tgz /path/to/images/*
Now when images.tgz is extracted, the contents that are extracted are /path/to/images/...
How I can only have the images included into the tgz file (and not the three folders that lead to the images)?
I know you can use --strip-components when untarring although I'm not sure if this would also work when creating.
Perhaps iterate through a folder structure and then pipe the results via stdout/stdin to tar sequentially? (with cat or similar?) IANA Linux Expert so afraid I can only theorise versus provide hard code at this second, you've got me wondering now though...