Linux command to view a file

I have a mywebapp.war  file  in ubuntu production server.
it has a web.xml file inside.

I want to  view this web.xml file.

What is the command to run ?   I dont want to unzip ....just want to view the content of web.xml file
cofactorAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Dave GouldConnect With a Mentor Onsite SupportCommented:
Just refrreshed and saw that I missed your last post

unzip -p mywebapp.war WEB-INF/web.xml

And no you dont need an editor unless you are really stuck with vi or vim.
If you only want to look at the file, you can just use cat or more
0
 
Patrick BogersDatacenter platform engineer LindowsCommented:
Hi

It is an archive which needs some kind of extraction like unzip before you can read the content.
0
 
ozoCommented:
unzip -p mywebapp.war  web.xml
0
A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

 
cofactorAuthor Commented:
It is an archive which needs some kind of extraction like unzip before you can read the content.

I am trying to avoid it  because of big file size.
0
 
cofactorAuthor Commented:
unzip -p mywebapp.war  web.xml


two issues ...

1.   Dont  i require any editor to view files ?

2.  also  folder path is  mywebapp.war > WEB-INF > web.xml   .....what would be the correct command ?
0
 
Dave GouldOnsite SupportCommented:
You can extract a single file from the .war as a .war is just a zipped archive.

unzip file.war web.xml

Yopu might need to add the full path to the xml file though
0
 
MazdajaiCommented:
Use zipinfo to list the files in the war file then use unzip -p to pipe the contents on standard output.
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
Your mywebapp.war is most likely unpacked on the webserver that runs your application, like Tomcat or JBoss for example. Do you know the location of your webserver? If you do, go there using cd and find your mywebapp.war - it should be unpacked and you could just view the web.xml using view or less.
0
 
cofactorAuthor Commented:
I'll give an update to this soon.
0
 
cofactorAuthor Commented:
what does  -p  does in unzip ?
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
From the manpage:

-p

extract files to pipe (stdout). Nothing but the file data is sent to stdout, and the files are always extracted in binary format, just as they are stored (no conversions).

So if  you use "unzip -p mywebapp.war web.xml" as ozo suggests, unzip would try and get web.xml from the .war file and display it on your console

But I just suggest you change to this:

unzip -p mywebapp.war WEB-INF/web.xml

Open in new window

as web.xml will be in the WEB-INF subfolder and the command suggested by ozo will give an error.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.