How can I extract a .war file with Linux command prompt?
A war file is just a zip file with a specific directory structure. So you can use unzip or the jar tool for unzipping.
WAR file is just a JAR file, to extract it, just issue following jar command – “ jar -xvf yourWARfileName. war “.
If you don't want to extract the file you can use vim filename. war to read the contents of the file. You can read subdirectories of files by selecting them and pressing enter. For this to work, you need the package unzip installed.
To unzip files, open File Manager, as explained in the Zipping Files via GUI section. Right click the ZIP package you'd like to extract, and select Extract Here, as shown below. Once you click Extract Here, Linux will extract all files in the ZIP package in the working directory.
Using unzip
unzip -c whatever.war META-INF/MANIFEST.MF
It will print the output in terminal.
And for extracting all the files,
unzip whatever.war
Using jar
jar xvf test.war
Note! The jar
command will extract war contents to current directory. Not to a subdirectory (like Tomcat does).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With