{"id":63500,"date":"2025-04-29T08:11:51","date_gmt":"2025-04-29T00:11:51","guid":{"rendered":"https:\/\/fwq.ai\/blog\/63500\/"},"modified":"2025-04-29T08:11:51","modified_gmt":"2025-04-29T00:11:51","slug":"linux%e4%b8%adpkill%e5%91%bd%e4%bb%a4%e8%af%a6%e8%a7%a3-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/63500\/","title":{"rendered":"linux\u4e2dpkill\u547d\u4ee4\u8be6\u89e3"},"content":{"rendered":"<blockquote><p>\n  pkill \u547d\u4ee4\u7528\u4e8e\u6839\u636e\u8fdb\u7a0b\u540d\u79f0\u6216\u5176\u4ed6\u6761\u4ef6\u7ec8\u6b62\u6b63\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u3002\u7528\u6237\u53ef\u4ee5\u901a\u8fc7\u63d0\u4f9b\u4ee5\u4e0b\u9009\u9879\u6765\u7ec6\u5316\u641c\u7d22:-signal\uff1a\u6307\u5b9a\u8981\u53d1\u9001\u7ed9\u8fdb\u7a0b\u7684\u4fe1\u53f7-user\uff1a\u6307\u5b9a\u8981\u7ec8\u6b62\u7531\u7279\u5b9a\u7528\u6237\u8fd0\u884c\u7684\u8fdb\u7a0b-x\uff1a\u4ec5\u7ec8\u6b62\u8fdb\u7a0b\u540d\u79f0\u5b8c\u5168\u5339\u914d\u6307\u5b9a\u6a21\u5f0f\u7684\u8fdb\u7a0b-f\uff1a\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u4f5c\u4e3a\u6a21\u5f0f\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/11\/2024051110361842622.jpg\" class=\"aligncenter\" title=\"linux\u4e2dpkill\u547d\u4ee4\u8be6\u89e3\u63d2\u56fe\" alt=\"linux\u4e2dpkill\u547d\u4ee4\u8be6\u89e3\u63d2\u56fe\" \/><\/p>\n<p><strong>Linux \u4e2d pkill \u547d\u4ee4\u8be6\u89e3<\/strong><\/p>\n<p><strong>\u4ec0\u4e48\u662f pkill \u547d\u4ee4\uff1f<\/strong><\/p>\n<p>pkill \u662f\u4e00\u79cd\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u7528\u4e8e\u6839\u636e\u8fdb\u7a0b\u540d\u79f0\u6216\u5176\u4ed6\u6761\u4ef6\u7ec8\u6b62\u6b63\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u3002<\/p>\n<p><strong>\u8bed\u6cd5<\/strong><\/p>\n<pre>pkill [-signal] [-user] [-x] [-f] &lt;pattern&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u9009\u9879<\/strong><\/p>\n<ul>\n<li> <strong>-signal\uff1a<\/strong>\u6307\u5b9a\u8981\u53d1\u9001\u7ed9\u8fdb\u7a0b\u7684\u4fe1\u53f7\uff08\u9ed8\u8ba4\u4e3a SIGTERM\uff09\u3002<\/li>\n<li> <strong>-user\uff1a<\/strong>\u6307\u5b9a\u8981\u7ec8\u6b62\u7531\u7279\u5b9a\u7528\u6237\u8fd0\u884c\u7684\u8fdb\u7a0b\u3002<\/li>\n<li> <strong>-x\uff1a<\/strong>\u4ec5\u7ec8\u6b62\u8fdb\u7a0b\u540d\u79f0\u5b8c\u5168\u5339\u914d\u6307\u5b9a\u6a21\u5f0f\u7684\u8fdb\u7a0b\u3002<\/li>\n<li> <strong>-f\uff1a<\/strong>\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u4f5c\u4e3a\u6a21\u5f0f\u3002<\/li>\n<\/ul>\n<p><strong>\u7528\u6cd5<\/strong><\/p>\n<p><strong>1. \u6839\u636e\u8fdb\u7a0b\u540d\u79f0\u7ec8\u6b62\u8fdb\u7a0b<\/strong><\/p>\n<pre>pkill &lt;process_name&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f8b\u5982\uff0c\u8981\u7ec8\u6b62\u6240\u6709\u540d\u4e3a &#8220;firefox&#8221; \u7684\u8fdb\u7a0b\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>pkill firefox<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>2. \u6839\u636e\u7528\u6237\u7ec8\u6b62\u8fdb\u7a0b<\/strong><\/p>\n<pre>pkill -u &lt;username&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f8b\u5982\uff0c\u8981\u7ec8\u6b62\u7531\u7528\u6237 &#8220;bob&#8221; \u8fd0\u884c\u7684\u6240\u6709\u8fdb\u7a0b\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>pkill -u bob<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3. \u6839\u636e\u6b63\u5219\u8868\u8fbe\u5f0f\u7ec8\u6b62\u8fdb\u7a0b<\/strong><\/p>\n<pre>pkill -f &lt;regex&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f8b\u5982\uff0c\u8981\u7ec8\u6b62\u6240\u6709\u4ee5 &#8220;chrome&#8221; \u5f00\u5934\u7684\u8fdb\u7a0b\u540d\u79f0\u7684\u8fdb\u7a0b\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>pkill -f ^chrome<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u4e2dpkill\u547d\u4ee4\u8be6\u89e3\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8FDCServers\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>pkill \u547d\u4ee4\u7528\u4e8e\u6839\u636e\u8fdb\u7a0b\u540d\u79f0\u6216\u5176\u4ed6\u6761\u4ef6\u7ec8\u6b62\u6b63\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u3002\u7528\u6237\u53ef\u4ee5\u901a\u8fc7\u63d0\u4f9b\u4ee5\u4e0b\u9009\u9879\u6765\u7ec6\u5316\u641c\u7d22:-signal\uff1a\u6307\u5b9a\u8981\u53d1\u9001\u7ed9\u8fdb\u7a0b\u7684\u4fe1\u53f7-user\uff1a\u6307\u5b9a\u8981\u7ec8\u6b62\u7531\u7279\u5b9a\u7528\u6237\u8fd0\u884c\u7684\u8fdb\u7a0b-x\uff1a\u4ec5\u7ec8\u6b62\u8fdb\u7a0b\u540d\u79f0\u5b8c\u5168\u5339\u914d\u6307\u5b9a\u6a21\u5f0f\u7684\u8fdb\u7a0b-f\uff1a\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u4f5c\u4e3a\u6a21\u5f0f Linux \u4e2d pkill \u547d\u4ee4\u8be6\u89e3 \u4ec0\u4e48\u662f pkill \u547d\u4ee4\uff1f pkill \u662f\u4e00\u79cd\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u7528\u4e8e\u6839\u636e\u8fdb\u7a0b\u540d\u79f0\u6216\u5176\u4ed6\u6761\u4ef6\u7ec8\u6b62\u6b63\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u3002 \u8bed\u6cd5 pkill [-signal] [-user] [-x] [-f] &lt;pattern&gt; \u767b\u5f55\u540e\u590d\u5236 \u9009\u9879 -signal\uff1a\u6307\u5b9a\u8981\u53d1\u9001\u7ed9\u8fdb\u7a0b\u7684\u4fe1\u53f7\uff08\u9ed8\u8ba4\u4e3a SIGTERM\uff09\u3002 -user\uff1a\u6307\u5b9a\u8981\u7ec8\u6b62\u7531\u7279\u5b9a\u7528\u6237\u8fd0\u884c\u7684\u8fdb\u7a0b\u3002 -x\uff1a\u4ec5\u7ec8\u6b62\u8fdb\u7a0b\u540d\u79f0\u5b8c\u5168\u5339\u914d\u6307\u5b9a\u6a21\u5f0f\u7684\u8fdb\u7a0b\u3002 -f\uff1a\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u4f5c\u4e3a\u6a21\u5f0f\u3002 \u7528\u6cd5 1. \u6839\u636e\u8fdb\u7a0b\u540d\u79f0\u7ec8\u6b62\u8fdb\u7a0b pkill &lt;process_name&gt; \u767b\u5f55\u540e\u590d\u5236 \u4f8b\u5982\uff0c\u8981\u7ec8\u6b62\u6240\u6709\u540d\u4e3a &#8220;firefox&#8221; \u7684\u8fdb\u7a0b\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a pkill firefox \u767b\u5f55\u540e\u590d\u5236 2. \u6839\u636e\u7528\u6237\u7ec8\u6b62\u8fdb\u7a0b pkill -u &lt;username&gt; \u767b\u5f55\u540e\u590d\u5236 \u4f8b\u5982\uff0c\u8981\u7ec8\u6b62\u7531\u7528\u6237 &#8220;bob&#8221; \u8fd0\u884c\u7684\u6240\u6709\u8fdb\u7a0b\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a pkill -u bob \u767b\u5f55\u540e\u590d\u5236 3. \u6839\u636e\u6b63\u5219\u8868\u8fbe\u5f0f\u7ec8\u6b62\u8fdb\u7a0b pkill -f &lt;regex&gt; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-63500","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63500","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=63500"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63500\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=63500"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=63500"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=63500"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}