{"id":210562,"date":"2023-12-22T05:55:20","date_gmt":"2023-12-21T21:55:20","guid":{"rendered":"https:\/\/www.idc.net\/help\/210562\/"},"modified":"2023-12-22T05:55:20","modified_gmt":"2023-12-21T21:55:20","slug":"linux-%e5%91%bd%e4%bb%a4%ef%bc%9aps-%e6%8a%a5%e5%91%8a%e5%bd%93%e5%89%8d%e8%bf%9b%e7%a8%8b%e7%9a%84%e5%bf%ab%e7%85%a7","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/210562\/","title":{"rendered":"Linux \u547d\u4ee4\uff1aps &#8211; \u62a5\u544a\u5f53\u524d\u8fdb\u7a0b\u7684\u5feb\u7167"},"content":{"rendered":"<p><title id=\"linux-%e5%91%bd%e4%bb%a4%ef%bc%9aps-%e6%8a%a5%e5%91%8a%e5%bd%93%e5%89%8d%e8%bf%9b%e7%a8%8b%e7%9a%84%e5%bf%ab%e7%85%a7-ZgvKbvhJyY\">Linux \u547d\u4ee4\uff1aps - \u62a5\u544a\u5f53\u524d\u8fdb\u7a0b\u7684\u5feb\u7167<\/title><\/p>\n<h1 id=\"linux-%e5%91%bd%e4%bb%a4%ef%bc%9aps-%e6%8a%a5%e5%91%8a%e5%bd%93%e5%89%8d%e8%bf%9b%e7%a8%8b%e7%9a%84%e5%bf%ab%e7%85%a7-ZgvKbvhJyY\">Linux \u547d\u4ee4\uff1aps - \u62a5\u544a\u5f53\u524d\u8fdb\u7a0b\u7684\u5feb\u7167<\/h1>\n<p>\u5728Linux\u7cfb\u7edf\u4e2d\uff0cps\u547d\u4ee4\u662f\u4e00\u4e2a\u975e\u5e38\u6709\u7528\u7684\u5de5\u5177\uff0c\u7528\u4e8e\u62a5\u544a\u5f53\u524d\u6b63\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u7684\u5feb\u7167\u3002\u5b83\u63d0\u4f9b\u4e86\u6709\u5173\u8fdb\u7a0b\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u5982\u8fdb\u7a0bID\uff08PID\uff09\u3001\u7236\u8fdb\u7a0bID\uff08PPID\uff09\u3001CPU\u4f7f\u7528\u7387\u3001\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\u7b49\u3002\u901a\u8fc7\u4f7f\u7528\u4e0d\u540c\u7684\u9009\u9879\uff0c\u6211\u4eec\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u9700\u6c42\u6765\u83b7\u53d6\u6240\u9700\u7684\u8fdb\u7a0b\u4fe1\u606f\u3002<\/p>\n<h2 id=\"%e5%9f%ba%e6%9c%ac%e7%94%a8%e6%b3%95-ZgvKbvhJyY\">\u57fa\u672c\u7528\u6cd5<\/h2>\n<p>\u8981\u4f7f\u7528ps\u547d\u4ee4\uff0c\u53ea\u9700\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u201cps\u201d\u5373\u53ef\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u5c06\u663e\u793a\u5f53\u524d\u7528\u6237\u7684\u6240\u6709\u8fdb\u7a0b\u3002<\/p>\n<pre><code>$ ps\n  PID TTY          TIME CMD\n 1234 pts\/0    00:00:00 bash\n 5678 pts\/0    00:00:00 ps\n<\/code><\/pre>\n<p>\u4e0a\u9762\u7684\u8f93\u51fa\u663e\u793a\u4e86\u4e24\u4e2a\u8fdb\u7a0b\u3002\u7b2c\u4e00\u5217\u662f\u8fdb\u7a0bID\uff08PID\uff09\uff0c\u7b2c\u56db\u5217\u662f\u8fdb\u7a0b\u7684\u547d\u4ee4\u540d\u79f0\u3002<\/p>\n<h2 id=\"%e5%b8%b8%e7%94%a8%e9%80%89%e9%a1%b9-ZgvKbvhJyY\">\u5e38\u7528\u9009\u9879<\/h2>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u7528\u7684ps\u547d\u4ee4\u9009\u9879\uff1a<\/p>\n<ul>\n<li><code>-e<\/code>\uff1a\u663e\u793a\u6240\u6709\u8fdb\u7a0b\uff0c\u800c\u4e0d\u4ec5\u4ec5\u662f\u5f53\u524d\u7528\u6237\u7684\u8fdb\u7a0b\u3002<\/li>\n<li><code>-f<\/code>\uff1a\u663e\u793a\u5b8c\u6574\u7684\u8fdb\u7a0b\u4fe1\u606f\uff0c\u5305\u62ec\u8fdb\u7a0b\u7684\u7236\u8fdb\u7a0bID\uff08PPID\uff09\u3001CPU\u4f7f\u7528\u7387\u3001\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\u7b49\u3002<\/li>\n<li><code>-l<\/code>\uff1a\u4ee5\u957f\u683c\u5f0f\u663e\u793a\u8fdb\u7a0b\u4fe1\u606f\uff0c\u5305\u62ec\u8fdb\u7a0b\u7684\u72b6\u6001\u3001\u4f18\u5148\u7ea7\u7b49\u3002<\/li>\n<li><code>-u<\/code>\uff1a\u663e\u793a\u8fdb\u7a0b\u7684\u6240\u6709\u8005\u3002<\/li>\n<\/ul>\n<p>\u4f8b\u5982\uff0c\u8981\u663e\u793a\u6240\u6709\u8fdb\u7a0b\u7684\u5b8c\u6574\u4fe1\u606f\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code>$ ps -ef\nUID        PID  PPID  C STIME TTY          TIME CMD\nroot         1     0  0 09:45 ?        00:00:01 \/sbin\/init\nroot         2     0  0 09:45 ?        00:00:00 [kthreadd]\nroot         3     2  0 09:45 ?        00:00:00 [ksoftirqd\/0]\n...\n<\/code><\/pre>\n<p>\u4e0a\u9762\u7684\u8f93\u51fa\u663e\u793a\u4e86\u7cfb\u7edf\u4e2d\u6240\u6709\u8fdb\u7a0b\u7684\u5b8c\u6574\u4fe1\u606f\u3002<\/p>\n<h2 id=\"%e8%bf%9b%e7%a8%8b%e8%bf%87%e6%bb%a4-ZgvKbvhJyY\">\u8fdb\u7a0b\u8fc7\u6ee4<\/h2>\n<p>\u4f7f\u7528ps\u547d\u4ee4\u7684\u9009\u9879\uff0c\u6211\u4eec\u53ef\u4ee5\u6839\u636e\u4e0d\u540c\u7684\u6761\u4ef6\u6765\u8fc7\u6ee4\u8fdb\u7a0b\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u8981\u663e\u793a\u7279\u5b9a\u7528\u6237\u7684\u8fdb\u7a0b\uff0c\u53ef\u4ee5\u4f7f\u7528<code>-u<\/code>\u9009\u9879\uff0c\u5e76\u6307\u5b9a\u7528\u6237\u540d\uff1a<\/p>\n<pre><code>$ ps -u username\n  PID TTY          TIME CMD\n 1234 pts\/0    00:00:00 bash\n 5678 pts\/0    00:00:00 ps\n<\/code><\/pre>\n<p>\u4e0a\u9762\u7684\u547d\u4ee4\u5c06\u663e\u793a\u7279\u5b9a\u7528\u6237\u7684\u8fdb\u7a0b\u3002<\/p>\n<p>\u8fd8\u53ef\u4ee5\u4f7f\u7528<code>-C<\/code>\u9009\u9879\u6765\u663e\u793a\u7279\u5b9a\u547d\u4ee4\u7684\u8fdb\u7a0b\uff1a<\/p>\n<pre><code>$ ps -C command_name\n  PID TTY          TIME CMD\n 1234 pts\/0    00:00:00 command_name\n 5678 pts\/0    00:00:00 ps\n<\/code><\/pre>\n<p>\u4e0a\u9762\u7684\u547d\u4ee4\u5c06\u663e\u793a\u7279\u5b9a\u547d\u4ee4\u7684\u8fdb\u7a0b\u3002<\/p>\n<h2 id=\"%e6%80%bb%e7%bb%93-ZgvKbvhJyY\">\u603b\u7ed3<\/h2>\n<p>ps\u547d\u4ee4\u662fLinux\u7cfb\u7edf\u4e2d\u4e00\u4e2a\u975e\u5e38\u6709\u7528\u7684\u5de5\u5177\uff0c\u7528\u4e8e\u62a5\u544a\u5f53\u524d\u6b63\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u7684\u5feb\u7167\u3002\u901a\u8fc7\u4f7f\u7528\u4e0d\u540c\u7684\u9009\u9879\uff0c\u6211\u4eec\u53ef\u4ee5\u83b7\u53d6\u6240\u9700\u7684\u8fdb\u7a0b\u4fe1\u606f\uff0c\u5e76\u6839\u636e\u9700\u8981\u8fdb\u884c\u8fdb\u7a0b\u8fc7\u6ee4\u3002\u4e86\u89e3\u548c\u719f\u7ec3\u4f7f\u7528ps\u547d\u4ee4\u5bf9\u4e8e\u7cfb\u7edf\u7ba1\u7406\u5458\u548c\u5f00\u53d1\u4eba\u5458\u6765\u8bf4\u662f\u975e\u5e38\u91cd\u8981\u7684\u3002<\/p>\n<p>\u9999\u6e2f\u670d\u52a1\u5668\u9996\u9009\u540e\u6d6a\u4e91\uff0c\u63d0\u4f9b\u9ad8\u6027\u80fd\u3001\u53ef\u9760\u7a33\u5b9a\u7684\u9999\u6e2f\u670d\u52a1\u5668\u89e3\u51b3\u65b9\u6848\u3002\u60a8\u53ef\u4ee5\u8bbf\u95ee<a href=\"https:\/\/idc.net\">https:\/\/idc.net<\/a>\u4e86\u89e3\u66f4\u591a\u4fe1\u606f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux \u547d\u4ee4\uff1aps - \u62a5\u544a\u5f53\u524d\u8fdb\u7a0b\u7684\u5feb\u7167 Linux \u547d\u4ee4\uff1aps - \u62a5\u544a\u5f53\u524d\u8fdb\u7a0b\u7684\u5feb\u7167 \u5728Linux\u7cfb [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[],"class_list":["post-210562","post","type-post","status-publish","format-standard","hentry","category-centos"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/210562","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=210562"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/210562\/revisions"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=210562"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=210562"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=210562"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}