How to Check Tomcat Version in Linux
Have you ever run into a situation where you needed to find information about a server but nobody had bothered document anything they did when they set it up? Are you administering a Linux server and just want to find out what version of Tomcat was installed? Are you a developer who wants to make sure your operations team installed the correct package in production? Maybe you’re a student who just wants to know how things work. Today we are going to show you how to check Tomcat version in Linux.
How to Check Tomcat Version in Linux Command Line
You can usually figure this out very easily by just looking at the running process. You should be able to see that path it is running from. This will typically contain the version number embedded right in the directoyr name. Use this command:
ps -ef |grep -i tomcat
how-to-check-tomcat-version-in-linux
Here is an example of what the output looks like and what you want to keep an eye out for.
Alternate Method - The “Right” Way
What if the path doesn’t contain the version? What if someone decided to use a more generic name for the directory for some reason? They might have just created a symlink. If so you can just see where that link is pointing. If not, there is another way of knowing which version of tomcat you have. This is really the best method. You can use the included version script. You will need to adjust your path but you can use this command:
/home/user1/tomcat/bin/version.sh
Here is what the output looks like. It includes all of the information you could possibly want.
If it happens to be a symlink:
More Options
Here is another creative method you might want to try:
cd tomcat/lib
java -cp catalina.jar org.apache.catalina.util.ServerInfo
If you happen to have the ability to upload a JSP page you can create something like this that tells you what version you are running:
Tomcat Version : <%= application.getServerInfo() %> <br>
Servlet Specification Version :
<%= application.getMajorVersion() %>. <%= application.getMinorVersion() %> <br>
JSP version :
<%=JspFactory.getDefaultFactory().getEngineInfo().getSpecificationVersion() %> <br>
If your Tomcat still has a default page configured to give you information, you can try going here: http://localhost:8080/. Of course swap localhost for your hostname unless you actually are running on the same machine.