{"id":1713,"date":"2023-09-26T00:22:41","date_gmt":"2023-09-25T16:22:41","guid":{"rendered":"https:\/\/blog.iotot.com\/?p=1713"},"modified":"2023-09-26T00:22:41","modified_gmt":"2023-09-25T16:22:41","slug":"linux-%e6%9f%a5%e7%9c%8b%e6%8c%87%e5%ae%9a%e5%90%8d%e7%a7%b0%e8%bf%9b%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/blog.iotot.com\/?p=1713","title":{"rendered":"linux \u67e5\u770b\u6307\u5b9a\u540d\u79f0\u8fdb\u7a0b"},"content":{"rendered":"<p>\u8981\u5728Linux\u4e2d\u67e5\u770b\u6307\u5b9a\u540d\u79f0\u7684\u8fdb\u7a0b\uff0c\u53ef\u4ee5\u4f7f\u7528<code>ps<\/code>\u547d\u4ee4\u7ed3\u5408<code>grep<\/code>\u6765\u5b9e\u73b0\u3002\u4ee5\u4e0b\u662f\u4e00\u79cd\u65b9\u6cd5\uff1a<\/p>\n<p>\u5047\u8bbe\u4f60\u8981\u67e5\u627e\u540d\u79f0\u4e3a<code>myprocess<\/code>\u7684\u8fdb\u7a0b\uff1a<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">ps aux | grep myprocess\r\n<\/pre>\n<p>\u8fd9\u4e2a\u547d\u4ee4\u7684\u542b\u4e49\u662f\uff1a<\/p>\n<ul>\n<li><code>ps aux<\/code>\uff1a\u5217\u51fa\u5f53\u524d\u7cfb\u7edf\u4e0a\u6240\u6709\u7684\u8fdb\u7a0b\u3002<\/li>\n<li><code>|<\/code>\uff1a\u7ba1\u9053\u7b26\u53f7\uff0c\u5c06<code>ps aux<\/code>\u7684\u8f93\u51fa\u4f20\u9012\u7ed9\u4e0b\u4e00\u4e2a\u547d\u4ee4\u3002<\/li>\n<li><code>grep myprocess<\/code>\uff1a\u4f7f\u7528<code>grep<\/code>\u547d\u4ee4\u8fc7\u6ee4\u5305\u542b\u5b57\u7b26\u4e32<code>myprocess<\/code>\u7684\u884c\uff0c\u8fd9\u5c06\u53ea\u663e\u793a\u540d\u79f0\u4e2d\u5305\u542b<code>myprocess<\/code>\u7684\u8fdb\u7a0b\u3002<\/li>\n<\/ul>\n<p>\u5728\u8fd0\u884c\u547d\u4ee4\u540e\uff0c\u4f60\u5c06\u770b\u5230\u5305\u542b\u6307\u5b9a\u540d\u79f0\u7684\u8fdb\u7a0b\u7684\u4fe1\u606f\u5217\u8868\u3002\u8bf7\u6ce8\u610f\uff0c<code>grep<\/code>\u4e5f\u4f1a\u5339\u914d\u5230\u547d\u4ee4\u884c\u4e2d\u5305\u542b\u6307\u5b9a\u540d\u79f0\u7684\u8fdb\u7a0b\uff0c\u56e0\u6b64\u7ed3\u679c\u53ef\u80fd\u5305\u62ec\u66f4\u591a\u4fe1\u606f\u3002<\/p>\n<p>\u5982\u679c\u4f60\u77e5\u9053\u5177\u4f53\u7684\u8fdb\u7a0b\u540d\u79f0\u5e76\u4e14\u53ea\u9700\u8981\u83b7\u53d6\u8fdb\u7a0b\u7684PID\uff08\u8fdb\u7a0b\u6807\u8bc6\u7b26\uff09\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528<code>pgrep<\/code>\u547d\u4ee4\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">pgrep myprocess\r\n<\/pre>\n<p>\u8fd9\u5c06\u76f4\u63a5\u8fd4\u56de\u5339\u914d\u540d\u79f0\u7684\u8fdb\u7a0b\u7684PID\uff0c\u800c\u4e0d\u9700\u8981\u8fdb\u4e00\u6b65\u7684\u8fc7\u6ee4\u3002<\/p>\n<p>\u8bf7\u5c06<code>myprocess<\/code>\u66ff\u6362\u4e3a\u4f60\u8981\u67e5\u627e\u7684\u5b9e\u9645\u8fdb\u7a0b\u540d\u79f0\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8981\u5728Linux\u4e2d\u67e5\u770b\u6307\u5b9a\u540d\u79f0\u7684\u8fdb\u7a0b\uff0c\u53ef\u4ee5\u4f7f\u7528ps\u547d\u4ee4\u7ed3\u5408grep\u6765\u5b9e\u73b0\u3002\u4ee5\u4e0b\u662f\u4e00\u79cd\u65b9\u6cd5\uff1a \u5047\u8bbe\u4f60\u8981\u67e5\u627e\u540d\u79f0\u4e3am [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.iotot.com\/index.php?rest_route=\/wp\/v2\/posts\/1713"}],"collection":[{"href":"https:\/\/blog.iotot.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.iotot.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.iotot.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.iotot.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1713"}],"version-history":[{"count":1,"href":"https:\/\/blog.iotot.com\/index.php?rest_route=\/wp\/v2\/posts\/1713\/revisions"}],"predecessor-version":[{"id":1714,"href":"https:\/\/blog.iotot.com\/index.php?rest_route=\/wp\/v2\/posts\/1713\/revisions\/1714"}],"wp:attachment":[{"href":"https:\/\/blog.iotot.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1713"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.iotot.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1713"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.iotot.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1713"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}