Wednesday, May 22, 2024

Multiple ways to extract zip files in linux terminal

I downloaded a big zip file (5.9GB) for an application, and as usual, to unzip it, just use unzip command.
$ unzip mybigfile.zip

I received this error, which is unusual.

Error when extracting using unzip command












Then I search around to find any other zip application that can extract the file. I am pretty confident that file is fine, since the provider has provided a md5sum file, and it matches. I ended up trying "jar" command. To install jar in ubuntu, simply run below command:
$ sudo apt update && sudo apt install fastjar -y

Once installed, extract the zip file using below command
$ jar xvf mybigfile.zip

Unfortunately, jar is also unable to extract the file, with below error:
Error when extracting using jar command





The I encounter another robust archiver called 7z, which can be installed in ubuntu using below command:
$ sudo apt update && sudo apt install 7zip -y

To extract a zip file, simply run this command:
$ 7z x mybigfile.zip

Even though 7z reported some error as well, but it managed to extract the file. 
Error when extracting using 7z command



There you go, 3 commands to extract a zip file. So do not worry if you are unable to extract any zip file, you can always try a few commands to get the job done.

No comments:

Post a Comment