java -ef - How do I kill this tomcat process in Terminal?

7 Answers

There is no need to know Tomcat's pid (process ID) to kill it. You can use the following command to kill Tomcat:

pkill -9 -f tomcat
which on

Using ps -ef | grep tomcat I found a tomcat server that is running. I tried kill -9 {id} but it returns "No such process." What am I doing wrong?

Here's an example:

Admins-MacBook-Pro:test-parent tom.maxwell$ ps -ef | grep tomcat
2043706342 39707 39695   0  3:40PM ttys000    0:00.00 grep tomcat
Admins-MacBook-Pro:test-parent tom.maxwell$ kill -9 39707
-bash: kill: (39707) - No such process

Tomcat is not running. Your search is showing you the grep process, which is searching for tomcat. Of course, by the time you see that output, grep is no longer running, so the pid is no longer valid.

just type the below command in terminal

ps -ef |grep 'catalina'

copy the value of process id then type the following command and paste process id

 kill -9 processid

ps -Af | grep "tomcat" | grep -v grep | awk '{print$2}' | xargs kill -9

This worked for me:

Step 1 : echo ps aux | grep org.apache.catalina.startup.Bootstrap | grep -v grep | awk '{ print $2 }'

This above command return "process_id"

Step 2: kill -9 process_id
// This process_id same as Step 1: output

In tomcat/bin/

add the following line after just after the comment section ends:


then, to kill a running instance of Tomcat, you can use:

kill -9 `cat someFile.txt`

To kill a process by name I use the following

ps aux | grep "search-term" | grep -v grep | tr -s " " | cut -d " " -f 2 | xargs kill -9

The tr -s " " | cut -d " " -f 2 is same as awk '{print $2}'. tr supressess the tab spaces into single space and cut is provided with <SPACE> as the delimiter and the second column is requested. The second column in the ps aux output is the process id.


java linux unix tomcat terminal