Viewing the contents of a war file with the Linux command zipinfo
Unzipping a war file is tedious, but you can use the zipinfo command to check the contents of a war file without unzipping it.
You can use zipinfo hoge.war to output the contents of the war file to stdout, and you can do the same with jar files.
[root@humidai tmp]# zipinfo hoge.war Archive: hoge.jar Zip file size: 552868 bytes, number of entries: 508 drwxr-xr-x 2.0 unx 0 bx stor 20-Nov-30 16:50 META-INF/ -rw-r--r-- 2.0 unx 103 b- defN 20-Nov-30 16:50 META-INF/MANIFEST.MF drwxr-xr-x 2.0 unx 0 b- stor 20-Nov-30 16:50 jp/ drwxr-xr-x 2.0 unx 0 b- stor 20-Nov-30 16:50 jp/co/ drwxr-xr-x 2.0 unx 0 b- stor 20-Nov-30 16:50 jp/co/confrage/ drwxr-xr-x 2.0 unx 0 b- stor 20-Nov-30 16:50 jp/co/confrage/libs/ . .
I wanted to see the size of the jar file in the war file, so in that case, if you use the grep command together, only that line will be standard output.
zipinfo hoge.war | grep fuga.jar
“-T” option
The -T option allows the standard output date format to be in YYYYYMMDD.hhMMss format.
[root@humidai tmp]# zipinfo -T hoge.war | grep fuga.jar -rw-r--r-- 2.0 unx 552188 b- defN 20201130.165022 jp/co/confrage/libs/fuga.jar
less
If you change the extension of war and jar files to zip, you can also use the LESS command for standard output.
mv hoge.war hoge.zip
This will zip the extension.
zipinfo command in Windows environment
Use the zipinfo command for a.war that exists in the Windows environment.
The WSL environment must be in place.
wsl zipinfo a.war | wsl grep .txt
コメント