{"id":11364,"date":"2019-03-13T07:20:24","date_gmt":"2019-03-13T07:20:24","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=11364"},"modified":"2019-03-13T07:20:24","modified_gmt":"2019-03-13T07:20:24","slug":"how-to-find-and-kill-running-processes-in-linux","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/13\/how-to-find-and-kill-running-processes-in-linux\/","title":{"rendered":"How to Find and Kill Running Processes in Linux"},"content":{"rendered":"<p>Process management is one of the important aspects of System Administration in Linux, and it includes killing of processes using the\u00a0<strong>kill<\/strong>\u00a0command.<\/p>\n<div id=\"attachment_17160\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Find-and-Kill-Running-Processes-in-Linux.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-17160\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Find-and-Kill-Running-Processes-in-Linux.png\" alt=\"Find and Kill Running Processes in Linux\" width=\"720\" height=\"345\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Find and Kill Running Processes in Linux<\/p>\n<\/div>\n<p>In this how-to, we shall look at killing of less productive or unwanted processes on your Linux system.<\/p>\n<h4>What is a Process in Linux?<\/h4>\n<p>A process on a Linux system can be a running occurrence of an application or program. You can also refer to processes as tasks executing in the operating system.<\/p>\n<p>When a process is running, it keeps on shifting from one state to another and a process can in one of the following states:<\/p>\n<ol>\n<li><strong>Running<\/strong>: meaning the process is either executing or it is just set to be executed.<\/li>\n<li><strong>Waiting<\/strong>: meaning that the process is waiting for an event or for a system resource to carry out a task.<\/li>\n<\/ol>\n<p>There are two types of waiting process under Linux namely\u00a0<strong>interruptible<\/strong>\u00a0and\u00a0<strong>uninterruptible<\/strong>.<\/p>\n<p>A waiting process that can be interrupted by signals is called\u00a0<strong>Interruptible<\/strong>, while a waiting process that is directly waiting on hardware conditions and cannot be interrupted under any conditions is called\u00a0<strong>uninterruptible<\/strong>.<\/p>\n<ol>\n<li><strong>Stopped<\/strong>: meaning that the process has been stopped, using a signal.<\/li>\n<li><strong>Zombie<\/strong>: meaning the process has been stopped abruptly and is dead.<\/li>\n<\/ol>\n<p>With this brief overview let us now look at ways of killing processes in a Linux system. We\u2019ve already covered a few articles on ways to kill Linux running processes us using kill, pkill, killall and xkill, you can read them below.<\/p>\n<ol>\n<li><a href=\"https:\/\/www.tecmint.com\/how-to-kill-a-process-in-linux\/\" target=\"_blank\" rel=\"noopener\">A Guide to Manage Linux Processes Using Kill, Pkill and Killall Commands<\/a><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/kill-processes-unresponsive-programs-in-ubuntu\/\" target=\"_blank\" rel=\"noopener\">How to Kill Unresponsive Linux Processes Using Xkill Command<\/a><\/li>\n<\/ol>\n<p>When killing processes, the\u00a0<strong>kill<\/strong>\u00a0command is used to send a named signal to a named process or groups of processes. The default signal is the\u00a0<strong>TERM<\/strong>\u00a0signal.<\/p>\n<p>Remember that the\u00a0<strong>kill<\/strong>\u00a0command can be a built-in function in many modern shells or external located at\u00a0<strong>\/bin\/kill<\/strong>.<\/p>\n<h3>How to Find Process PID in Linux<\/h3>\n<p>In Linux every process on a system has a\u00a0<strong>PID<\/strong>\u00a0(<strong>Process Identification Number<\/strong>) which can be used to kill the process.<\/p>\n<p>You can identify the\u00a0<strong>PID<\/strong>\u00a0of any process by using the\u00a0<strong>pidof<\/strong>\u00a0command as follows:<\/p>\n<pre>$ pidof firefox\r\n$ pidof chrome\r\n$ pidof gimp-2.8\r\n<\/pre>\n<div id=\"attachment_17153\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Find-Process-PID-in-Linux.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-17153\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Find-Process-PID-in-Linux.gif\" alt=\"Find Process PID in Linux\" width=\"893\" height=\"458\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Find Process PID in Linux<\/p>\n<\/div>\n<h3>How to Kill Processes in Linux<\/h3>\n<p>Once you find the process PID, let us now look at how to kill processes. In this first example, I am going to first get the PID of the process and then send a signal to it.<\/p>\n<p>I want to kill\u00a0<strong>gimp<\/strong>\u00a0process, so I will do it as follows:<\/p>\n<pre>$ pidof gimp-2.8\r\n$ kill 9378\r\n<\/pre>\n<p>To verify that the process has been killed, run the\u00a0<strong>pidof<\/strong>\u00a0command and you will not be able to view the\u00a0<strong>PID<\/strong>.<\/p>\n<pre>$ pidof gimp-2.8\r\n<\/pre>\n<div id=\"attachment_17154\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Kill-Linux-Process-PID.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-17154\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Kill-Linux-Process-PID.gif\" alt=\"Kill Linux Process PID\" width=\"893\" height=\"458\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Kill Linux Process PID<\/p>\n<\/div>\n<p>You can also send a named signal to the process by using the signal name or numbers as follows:<\/p>\n<pre>$ pidof vlc\r\n$ kill -SIGTERM 9541\r\n$ pidof vlc\r\n<\/pre>\n<div id=\"attachment_17155\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Kill-Process-PID-by-Signal.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-17155\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Kill-Process-PID-by-Signal.gif\" alt=\"Kill Linux Process PID by Signal\" width=\"893\" height=\"458\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Kill Process PID by Signal<\/p>\n<\/div>\n<p>Using the signal number to kill a process:<\/p>\n<pre>$ pidof banshee\r\n$ kill -9 9647\r\n$ pidof banshee\r\n<\/pre>\n<div id=\"attachment_17156\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Kill-Process-PID-by-Number.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-17156\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Kill-Process-PID-by-Number.gif\" alt=\"Kill Linux Process PID by Number\" width=\"893\" height=\"458\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Kill Process PID by Number<\/p>\n<\/div>\n<p>In the above example, the number\u00a0<code>9<\/code>\u00a0is the signal number for the\u00a0<strong>SIGKILL<\/strong>\u00a0signal.<\/p>\n<h3>How to Kill Multiple Process PID\u2019s in Linux<\/h3>\n<p>To kill more than one process, pass the\u00a0<strong>PID(s)<\/strong>\u00a0to the kill command as follows:<\/p>\n<pre>$ pidof gimp-2.8\r\n$ pidof vlc\r\n$ pidof banshee\r\n$ kill -9 9734 9747 9762\r\n<\/pre>\n<div id=\"attachment_17157\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Kill-Multiple-Linux-Process-PIDs.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-17157\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Kill-Multiple-Linux-Process-PIDs.gif\" alt=\"Kill Multiple Linux Process PID's\" width=\"893\" height=\"458\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Kill Multiple Linux Process PID\u2019s<\/p>\n<\/div>\n<h3>Summary<\/h3>\n<p>There are many other ways of killing processes in Linux, these few examples just help to give you an overview of killing processes. Do let us know how you kill processes in Linux? and also tell other ways if any via comments.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/find-and-kill-running-processes-pid-in-linux\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Process management is one of the important aspects of System Administration in Linux, and it includes killing of processes using the\u00a0kill\u00a0command. Find and Kill Running Processes in Linux In this how-to, we shall look at killing of less productive or unwanted processes on your Linux system. What is a Process in Linux? A process on &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/13\/how-to-find-and-kill-running-processes-in-linux\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to Find and Kill Running Processes in Linux&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-11364","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/11364","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=11364"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/11364\/revisions"}],"predecessor-version":[{"id":11365,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/11364\/revisions\/11365"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=11364"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=11364"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=11364"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}