Skip to content

Tomcat Version Command Line: How to Check from Terminal

I was setting up a CI/CD pipeline for a Java web application and needed to verify the Tomcat version on a remote server. The problem? The server was headless, and I only had SSH access. I couldn’t just open a browser and check the Tomcat Manager GUI.

After some digging, I found two simple command-line methods that work perfectly for this scenario.

The Problem

When you’re working on headless servers, automated deployment scripts, or SSH sessions, you don’t have access to GUI tools. You need a way to check the Tomcat version without starting the server or using a web interface.

I tried a few approaches before finding the right solution.

Finding the Right Commands

First, I navigated to my Tomcat installation directory:

Navigate to Tomcat
cd /opt/tomcat

Then I discovered two scripts in the bin directory that display version information.

Method 1: Using version.sh

The most straightforward approach is using the dedicated version script:

Check Tomcat version with version.sh
./bin/version.sh

Output:

version.sh output
Using CATALINA_BASE: /opt/tomcat
Using CATALINA_HOME: /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME: /usr
Using CLASSPATH: /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
Server version: Apache Tomcat/10.1.52
Server built: Jan 23 2026 19:29:07 UTC
Server number: 10.1.52.0
OS Name: Linux
OS Version: 6.1.0-30-amd64
Architecture: amd64
JVM Version: 17.0.18+8-Debian-1deb12u1
JVM Vendor: Debian

This script shows everything: the Tomcat version, build date, OS details, and JVM information.

Method 2: Using catalina.sh version

The main catalina script also supports a version argument:

Check Tomcat version with catalina.sh
./bin/catalina.sh version

This produces identical output to version.sh. I found this useful when I was already working with catalina.sh for other server operations.

Why These Scripts Work So Well

The key insight is that these scripts don’t require Tomcat to be running. They read version information directly from the Tomcat JAR files and system properties. This makes them perfect for:

  • Remote servers via SSH - No need to start the server
  • CI/CD pipelines - Script-friendly output
  • Automation scripts - Easy to parse and log

Practical Examples

Extract Just the Version Number

When I needed just the version for my deployment script, I filtered the output:

Filter for version only
./bin/version.sh | grep "Server version"

Output:

Filtered output
Server version: Apache Tomcat/10.1.52

Using catalina.jar Directly

I also discovered an alternative method that works without the shell scripts:

Alternative method using catalina.jar
java -cp /opt/tomcat/lib/catalina.jar org.apache.catalina.util.ServerInfo

Output:

ServerInfo output
Server version: Apache Tomcat/10.1.52
Server built: Jan 23 2026 19:29:07 UTC
Server number: 10.1.52.0
OS Name: Linux
OS Version: 6.1.0-30-amd64
Architecture: amd64
JVM Version: 17.0.18+8-Debian-1deb12u1
JVM Vendor: Debian

This approach is useful when the shell scripts aren’t available or when you want to check Tomcat from a different working directory.

Common Mistakes I Made

Mistake 1: Wrong Directory

I initially tried running the scripts from my home directory:

Wrong directory error
$ ~/version.sh
bash: /home/user/version.sh: No such file or directory

The scripts must be run relative to the Tomcat installation directory or with full paths.

Mistake 2: Missing Execute Permissions

On one server, I got a permission error:

Permission denied error
$ ./bin/version.sh
bash: ./bin/version.sh: Permission denied

Fixed with:

Add execute permission
chmod +x bin/version.sh bin/catalina.sh

Mistake 3: Confusing with Other Scripts

I initially tried ./bin/startup.sh thinking it would show version info, but that only starts the server. The version scripts are specifically for displaying version information.

Windows Users

If you’re on Windows, use the batch files instead:

Windows version commands
C:\tomcat\bin\version.bat
C:\tomcat\bin\catalina.bat version

These produce the same output format as the Unix/Linux scripts.

Integration into Automation

Here’s how I integrated version checking into my deployment script:

Deployment script example
#!/bin/bash
TOMCAT_HOME="/opt/tomcat"
REQUIRED_VERSION="10.1"
# Check Tomcat version
CURRENT_VERSION=$($TOMCAT_HOME/bin/version.sh | grep "Server version" | awk '{print $4}')
if [[ ! $CURRENT_VERSION == $REQUIRED_VERSION* ]]; then
echo "ERROR: Tomcat version mismatch. Required: $REQUIRED_VERSION.x, Found: $CURRENT_VERSION"
exit 1
fi
echo "Tomcat version check passed: $CURRENT_VERSION"
# Continue with deployment...

This script extracts the version number and validates it before proceeding with deployment.

When to Use Each Method

Use version.sh when:

  • You just need to check the version
  • You’re in the Tomcat directory
  • You want the simplest command

Use catalina.sh version when:

  • You’re already using catalina.sh for other operations
  • You want consistency with other catalina commands

Use the catalina.jar method when:

  • Shell scripts aren’t available
  • You need to run from outside the Tomcat directory
  • You’re in a constrained environment

Final Words + More Resources

My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me

Here are also the most important links from this article along with some further resources that will help you in this scope:

Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!

Comments