<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>thel Archives - Linux Windows and android Tutorials</title>
	<atom:link href="https://www.osradar.com/tag/thel/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.osradar.com</link>
	<description>tutorials and news and Seurity</description>
	<lastBuildDate>Wed, 18 Sep 2019 19:50:26 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.12</generator>
	<item>
		<title>how to kill process in Linux</title>
		<link>https://www.osradar.com/how-to-kill-process-in-linux/</link>
					<comments>https://www.osradar.com/how-to-kill-process-in-linux/#respond</comments>
		
		<dc:creator><![CDATA[Muhammad Nabeel]]></dc:creator>
		<pubDate>Wed, 18 Sep 2019 19:50:20 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bignner]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[kalilinux]]></category>
		<category><![CDATA[process]]></category>
		<category><![CDATA[thel]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=13596</guid>

					<description><![CDATA[<p>A process is the instance of a computer program that is being executed by one or many threads. It contains the program code and its activity. Several processes may be associated with the same program; for example, opening up several instances of the same program often results in more than one process being executed. kill [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-kill-process-in-linux/">how to kill process in Linux</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>A process is the instance of a computer program that is being executed by one or many threads. It contains the program code and its activity. Several processes may be associated with the same program; for example, opening up several instances of the same program often results in more than one process being executed.</p>
<p>kill is a command which is used in several popular operating systems to send signals to running processes. In Linux kill command is normally used to terminate running process. In this article we will cover basics of kill command so you will understand it and apply it in your environment.</p>
<p>Before killing or terminating any process we have to get its process ID (PID) or process name. We can use wo commands to find process ID&#8217;s, first is &#8220;ps&#8221; command and the second it &#8220;top&#8221; command. In this article we will use ps command to find a process ID and its name.</p>
<h3><strong>Locate process using ps command</strong></h3>
<p>ps command is used to see processes, following command to list all running processes.</p>
<pre>ps aux</pre>
<p>a: Show processes for all users<br />
u: Display the user who is using the process<br />
x: Show all processes. (it also show the processes running in a GUI environment)</p>
<p><img loading="lazy" class="alignnone wp-image-13598" src="https://www.osradar.com/wp-content/uploads/2019/09/1-8-300x160.png" alt="kill process in Linux" width="662" height="353" srcset="https://www.osradar.com/wp-content/uploads/2019/09/1-8-300x160.png 300w, https://www.osradar.com/wp-content/uploads/2019/09/1-8-768x409.png 768w, https://www.osradar.com/wp-content/uploads/2019/09/1-8-1024x546.png 1024w, https://www.osradar.com/wp-content/uploads/2019/09/1-8-696x371.png 696w, https://www.osradar.com/wp-content/uploads/2019/09/1-8-1068x569.png 1068w, https://www.osradar.com/wp-content/uploads/2019/09/1-8-788x420.png 788w, https://www.osradar.com/wp-content/uploads/2019/09/1-8.png 1920w" sizes="(max-width: 662px) 100vw, 662px" /></p>
<h3><strong>List specific process ID</strong></h3>
<p>If you want to search any specific process so you can use any of following three methods.</p>
<p><strong>Method 1:</strong></p>
<pre>ps -aux | grep process-name</pre>
<p>e.g check for Apache process</p>
<pre>ps -aux | grep httpd</pre>
<p><img loading="lazy" class="alignnone wp-image-13599" src="https://www.osradar.com/wp-content/uploads/2019/09/2-7-300x48.png" alt="kill process in Linux" width="675" height="108" srcset="https://www.osradar.com/wp-content/uploads/2019/09/2-7-300x48.png 300w, https://www.osradar.com/wp-content/uploads/2019/09/2-7-768x124.png 768w, https://www.osradar.com/wp-content/uploads/2019/09/2-7-1024x165.png 1024w, https://www.osradar.com/wp-content/uploads/2019/09/2-7-696x112.png 696w, https://www.osradar.com/wp-content/uploads/2019/09/2-7-1068x172.png 1068w, https://www.osradar.com/wp-content/uploads/2019/09/2-7.png 1920w" sizes="(max-width: 675px) 100vw, 675px" /></p>
<p>You can see process id&#8217;s of Apache in above image.</p>
<h3><strong>Method 2:</strong> <strong>Use pidof command</strong></h3>
<pre>pidof httpd</pre>
<p>Sample outputs:</p>
<pre>4372 4371 4370 4369 4368 4361</pre>
<p><img loading="lazy" class="alignnone wp-image-13600" src="https://www.osradar.com/wp-content/uploads/2019/09/3-8-300x49.png" alt="kill process in Linux" width="673" height="110" srcset="https://www.osradar.com/wp-content/uploads/2019/09/3-8-300x49.png 300w, https://www.osradar.com/wp-content/uploads/2019/09/3-8-768x127.png 768w, https://www.osradar.com/wp-content/uploads/2019/09/3-8-1024x169.png 1024w, https://www.osradar.com/wp-content/uploads/2019/09/3-8-696x115.png 696w, https://www.osradar.com/wp-content/uploads/2019/09/3-8.png 1037w" sizes="(max-width: 673px) 100vw, 673px" /></p>
<h3><strong>Method 3: Use pgrep command</strong></h3>
<pre>pgrep httpd</pre>
<p><img loading="lazy" class="alignnone wp-image-13601" src="https://www.osradar.com/wp-content/uploads/2019/09/4-8-300x67.png" alt="kill process in Linux" width="663" height="148" srcset="https://www.osradar.com/wp-content/uploads/2019/09/4-8-300x67.png 300w, https://www.osradar.com/wp-content/uploads/2019/09/4-8-768x171.png 768w, https://www.osradar.com/wp-content/uploads/2019/09/4-8-1024x228.png 1024w, https://www.osradar.com/wp-content/uploads/2019/09/4-8-696x155.png 696w, https://www.osradar.com/wp-content/uploads/2019/09/4-8-1068x237.png 1068w, https://www.osradar.com/wp-content/uploads/2019/09/4-8.png 1210w" sizes="(max-width: 663px) 100vw, 663px" /></p>
<p>All above methods will show process ID&#8217;s of httpd (Apache) process.</p>
<h3><strong>Kill Process</strong></h3>
<p>kill command is use to terminate or kill running processes.</p>
<h3><strong>Method 1: Kill process by its process ID</strong></h3>
<p>Now, I will kill one Apache process using its process ID.</p>
<pre>kill -9 4372</pre>
<p>Then, verify that PID is killed</p>
<pre>pidof httpd</pre>
<p><img loading="lazy" class="alignnone wp-image-13602" src="https://www.osradar.com/wp-content/uploads/2019/09/5-7-300x44.png" alt="kill process in Linux" width="668" height="98" srcset="https://www.osradar.com/wp-content/uploads/2019/09/5-7-300x44.png 300w, https://www.osradar.com/wp-content/uploads/2019/09/5-7-768x113.png 768w, https://www.osradar.com/wp-content/uploads/2019/09/5-7-1024x151.png 1024w, https://www.osradar.com/wp-content/uploads/2019/09/5-7-696x102.png 696w, https://www.osradar.com/wp-content/uploads/2019/09/5-7-1068x157.png 1068w, https://www.osradar.com/wp-content/uploads/2019/09/5-7.png 1114w" sizes="(max-width: 668px) 100vw, 668px" /></p>
<p>So you can see in above image that process 4372 is no more exist.</p>
<h3><strong>Method 2: Kill process by its name</strong></h3>
<p>If you want to kill all the processes of a service you can use this method.</p>
<pre>kill -9 httpd</pre>
<p>OR</p>
<pre>pkill httpd</pre>
<p>Now, verify process is killed.</p>
<pre>pidof httpd</pre>
<p>Then, you will see that all processes of httpd will no more exist.</p>
<h3><strong>Kill all processes of a User</strong></h3>
<p>You can use below command to show processes of a user.</p>
<pre>ps -fu user-name</pre>
<p>Now you will get process ID&#8217;s of that user. E.g I show process ID&#8217;s of user &#8220;<strong>osradar</strong>&#8221; in below image</p>
<p><img loading="lazy" class="alignnone wp-image-13647" src="https://www.osradar.com/wp-content/uploads/2019/09/6-13-300x51.png" alt="kill process in Linux" width="682" height="116" srcset="https://www.osradar.com/wp-content/uploads/2019/09/6-13-300x51.png 300w, https://www.osradar.com/wp-content/uploads/2019/09/6-13-768x131.png 768w, https://www.osradar.com/wp-content/uploads/2019/09/6-13-1024x175.png 1024w, https://www.osradar.com/wp-content/uploads/2019/09/6-13-696x119.png 696w, https://www.osradar.com/wp-content/uploads/2019/09/6-13-1068x182.png 1068w, https://www.osradar.com/wp-content/uploads/2019/09/6-13.png 1343w" sizes="(max-width: 682px) 100vw, 682px" /></p>
<p>Then, run below command to kill all processes of the user</p>
<pre>kill -HUP process-ids</pre>
<p><img loading="lazy" class="alignnone wp-image-13648" src="https://www.osradar.com/wp-content/uploads/2019/09/7-12-300x57.png" alt="kill user in Linux" width="684" height="130" srcset="https://www.osradar.com/wp-content/uploads/2019/09/7-12-300x57.png 300w, https://www.osradar.com/wp-content/uploads/2019/09/7-12-768x146.png 768w, https://www.osradar.com/wp-content/uploads/2019/09/7-12-696x132.png 696w, https://www.osradar.com/wp-content/uploads/2019/09/7-12.png 809w" sizes="(max-width: 684px) 100vw, 684px" /></p>
<p>So, when you run again below command you will see no result.</p>
<pre>ps -fu user-name</pre>
<p>That&#8217;s it, You now know that how to kill running processes in Linux.</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-kill-process-in-linux/">how to kill process in Linux</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/how-to-kill-process-in-linux/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
