Search Our Database
How to check Apache Tomcat status using the Command Line Interface (CLI)
Introduction
Apache Tomcat is a widely used open-source implementation of the Java Servlet, JavaServer Pages, and Java Expression Language technologies. It provides a “pure Java” HTTP web server environment for running Java code. Administrators and developers often need to check the status of the Tomcat service, especially when troubleshooting issues or verifying deployment configurations.
Knowing how to check the status of Apache Tomcat via the command line interface (CLI) is essential for system administrators who manage Linux or Unix-based servers, where graphical interfaces are often unavailable or avoided. Command-line tools provide a fast, scriptable, and efficient way to monitor and control server processes. This is particularly important in production environments, continuous integration pipelines, or cloud deployments.
This article explains how to check the running status of Apache Tomcat using various CLI methods. It also highlights the use of systemd, traditional process checks, and built-in Tomcat scripts. This guide is suitable for users managing Apache Tomcat 9.x or newer on Linux systems such as Ubuntu, CentOS, or Debian.
Key use cases include verifying service uptime, confirming a successful Tomcat start after deployment, diagnosing unexpected shutdowns, or integrating status checks into automation scripts. The guide provides several methods to suit different server setups, including systems with and without systemd integration.
Prerequisites
- A server running a Linux distribution such as Ubuntu 20.04+, CentOS 7+, or Debian 10+
- Apache Tomcat installed (version 9.0.x or newer is recommended)
- Terminal or SSH access with sudo privileges
- Tomcat installed either via system package manager or manually in a custom directory
- JAVA_HOME environment variable configured correctly if Tomcat is installed manually
Step-by-step Guide
Step 1: Check Tomcat Status with systemctl (Systemd)
On most modern Linux distributions, Apache Tomcat runs as a service managed by systemd
sudo systemctl status tomcat
If Tomcat was installed manually and registered as a custom service (e.g., tomcat9), the service name may differ:
sudo systemctl status tomcat9
Step 2: Verify Tomcat Process via ps Command
If Tomcat is not managed by systemd, the status can be verified by checking Java processes:
ps aux | grep tomcat
This command displays running Tomcat processes. A healthy Tomcat server typically shows a Java process pointing to catalina or bootstrap.
ps aux | grep tomcat | grep -v grep
Step 3: Use curl to Check if Tomcat Responds on Port 8080
If the server is accessible and Tomcat is configured on the default port (8080), use curl:
curl -I http://localhost:8080
A running server will return HTTP headers such as HTTP/1.1 200 OK or HTTP/1.1 403 Forbidden.
🖊️ Tip: If Tomcat is bound to a specific IP or port, update the curl command accordingly.
Step 4: Use Tomcat’s catalina.sh Script to Check Status
For manually installed Tomcat servers, the catalina.sh script provides control and status access.
Navigate to the bin directory of the Tomcat installation:
cd /opt/tomcat/bin
./catalina.sh status
Step 5: Use netstat or ss to Check Listening Ports
To verify if Tomcat is listening on port 8080:
sudo netstat -tulnp | grep 8080
or using ss:
sudo ss -tulnp | grep 8080
This confirms whether Tomcat is bound to the correct port and actively listening for requests.
Conclusion
Monitoring Apache Tomcat’s status through the command line is essential for maintaining application availability and quickly diagnosing issues. This guide covered multiple methods, including using systemctl, checking Java processes with ps, issuing HTTP requests via curl, and using Tomcat’s built-in scripts.
These techniques support both systemd-managed and manually installed Tomcat environments. Further automation and scripting can be built upon these checks for continuous monitoring or deployment pipelines.
For additional resources, consider reviewing Tomcat’s log files located in the /logs directory or integrating monitoring solutions like Nagios or Prometheus for long-term tracking.
Should you have any inquiries about the guidelines, please feel free to open a ticket through your portal account or contact us at support@ipserverone.com. We’ll be happy to assist you further.