Showing posts with label jar. Show all posts
Showing posts with label jar. Show all posts

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.

Thursday, February 8, 2018

Extracting and creating war files in centos

To manipulate war files, you need a command called jar, and this command is available from openjdk-devel package.


Install openjdk-devel -y
# yum install java-1.8.0-openjdk-devel

You should be able to use jar command
# which jar
/usr/bin/jar

View the content of a war file
# jar tf sample.jar

Extract the content of a war file
# jar xf sample.jar

Create war from files
# jar cf sample.jar /path/to/files