I need to search for a file (logo.png), in a folder that contains war, ear, and jar archive files. Can anyone help me with the command?
33 Answers
Searching inside jar files:
find . -name \*.jar -exec sh -c 'printf "\n\nFile: {}"; jar tf {}' ";" | less +/fooAnd similar with war files:
find . -name \*.war -exec sh -c 'printf "\n\nFile: {}"; unzip -l {}' ";" | less +/fooChange foo with text of your interest (such as abc.png).
You can press:
- n to search for the next pattern match.
- Shift+n to search backwards,
- / + type
something+ Enter to search for another phrase.
See similar, but on Windows: Finding which jars contain a file
2You can use unzip command for this purpose:
unzip -t example.war |grep filename jar tvf foo.war | grep filename
1