How to View and Kill Running Process in Linux?

Connect with

psand kill are two powerfull utility tool in linux to view running processes an to kill running process respectily on terminal in Linux. In this post I tried to demonstrate following things:

  1. how to view running process in Linux command terminal.
  2. how to kill any running process in Linux command terminal

At the end of reading this post , you can learnt how to find any running process on any specific port and how to kill those running process by using PID (Process ID). However, there are different tool which you can install to view running process but this post is about root level in Linux/ UNIX.

1. Prerequisite

Open a terminal of Linux/Unix terminal and type command to view what are the processes running on which port. You can filter out any port number or any process running in your system.

2. How to view all running prcesses?


ps -ef
ps -aux

You can take help to view all available options in ps command

 man  ps

3. How to view process id of Tomcat or Java?

On my system , I run Tomcat on 8080 port so you can view process id where Tomcat running.


ps -ef | grep 

or you can use following command too.

ps -ef | grep tomcat

Here, tomcat is the process name which are running on port 8080 and grep command used here to filter out from all output of ps command.

console output:

root@ranjeet:~# ps -ef | grep tomcat
root      4310     1  0 Jul02 ?        00:59:35 /usr/lib/jvm/java-7-oracle/bin/java -Djava.util.logging.config.file=/opt/apache-tomcat-7.0.57/conf/ -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.rmi.server.hostname= -Xms3072M -Xmx7168M -Djava.endorsed.dirs=/opt/apache-tomcat-7.0.57/endorsed -classpath /opt/apache-tomcat-7.0.57/bin/bootstrap.jar:/opt/apache-tomcat-7.0.57/bin/tomcat-juli.jar -Dcatalina.base=/opt/apache-tomcat-7.0.57 -Dcatalina.home=/opt/apache-tomcat-7.0.57 org.apache.catalina.startup.Bootstrap start
root     31852 31678  0 12:11 pts/5    00:00:00 grep --color=auto tomcat

here, process id is 4310

4. How to kill any running process by pid?


kill -9 

console output:

kill -9 4310

Now, you can check whether any process running on port 8080 or not, you can check again, as console output says nothing running on port 8080.

Terminal output:

ps -ef | grep tomcat

Your comments are welcome to improve this post. Happy Learning 🙂

Connect with

Leave a Reply

Your email address will not be published. Required fields are marked *