I am trying to view the content of a .war file. I first did set its permissions with chmod 777 then when I try to accces it using:

cd /usr/local/standalone/deployments/Sample.war/WEB-INF/classes/

It is giving cd: /usr/local/standalone/deployments/Sample.war/WEB-INF/classes/: Not a directory and I am not able to proceed further.

Can someone help me in this issue?

  • 5
    Don't use chmod 777 on a compressed file. You don't need execution bit for reading it. A safe 644 or 640 is recommended.
    – Braiam
    Jul 23, 2013 at 11:31
  • See the official Java docs: docs.oracle.com/javase/tutorial/deployment/jar/view.html
    – slm
    Jul 23, 2013 at 13:31
  • Is /usr/local/standalone/deployments/Sample.war a directory or a file ?
    – jlliagre
    Jul 23, 2013 at 14:16

6 Answers 6


.war files are packed. You can extract the information by using either of the following commands:

jar -xvf Sample.war
unzip Sample.war

You should then be able to run cd /usr/local/standalone/deployments/Sample.war/WEB-INF/classes/

  • 3
    jar -xvf *war won't work if there is more than one war file in the current directory. tar -xvfz won't work at all, you are confusing gzipped files and zipped ones.
    – jlliagre
    Jul 23, 2013 at 14:14
  • This is true, I didn't mean to infer that it would work with multiple wars, just that you could use that command verbatim for any one war. I've changed it
    – JZeolla
    Jul 23, 2013 at 14:48
  • 1
    I think it's better to use jar -tvf and not the proposed jar -xvf way. So files aren't extracted (and contaminate your .) but just listed.
    – Dror Cohen
    Mar 31, 2015 at 9:52

.war files are zipped archives.

You can list what they contain with either

jar tvf Sample.war


zipinfo Sample.war

Should you want to see the content of files stored in an archive, you need to first extract it somewhere:

mkdir /tmp/foo
cd /tmp/foo
unzip /usr/local/standalone/deployments/Sample.war
ls -l WEB-INF/classes/

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.
    – Thaoden
    Jun 2, 2017 at 8:52

First you have to extract the war file jar xvf Sample.war. Then you can cd in to the war file.


If the unix commands does not work, ftp the file to local machine.

.jar or .war or .ear any archive file can be opened in 7-Zip by following the steps below -

  1. Right click the archive file
  2. 7-Zip
  3. Open archive

You should be able to see all the archive file contents. Now browse through the folder/file and then right click -> edit the file -> save the file.


Besides extracting them with jar or unzip, you can also use the Midnight Commander (mc) and navigate to these files and press Enter on them as if they were directories.

If this doesn't immediately work, your flavour of mc is not configured to know the .war suffix, but you can still use this feature by typing either cd Sample.war#uzip (old mc) or cd Sample.war/uzip:// (mc in Debian unstable) and pressing Enter. As an added benefit, pressing Escape then Enter (in some terminals, also Alt-Enter but this is not portable so don’t depend on it) inserts the current filename into the command line, but you’ll have to press Backspace too because it adds a space, and the #uzip or /uzip:// needs to immediately follow the filename.

This is known as the mc VFS (virtual filesystem).

I won’t repeat the unzip/fastjar/jar answers here, but they’re also correct.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .