How to View and Kill Running Process in Linux?

Connect with

kill running process Linuxps and kill are two powerful commands and utility tools in Linux/Unix/Mac to view running processes and to kill running process Linux respectively on terminal of Linux/Unix/Mac.

1. overview to kill running process Linux

In this post, I tried to demonstrate 2 topics first one is view running process and kill running process.

  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 kill runnng process in Linux/ UNIX.

You can visit grep command in Linux and for all Linux posts on Linux tutorial page

1. Prerequisite for killing running process

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 {processname}

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?

Syntax of kill command

kill -9 {processid}

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.

to search tomcat process:

ps -ef | grep tomcat

Your comments are welcome to improve this post about how to view your running post and how to kill running process in Linux. Happy Learning 🙂
Linux official site

Connect with

Leave a Comment

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