{"id":5045,"date":"2019-09-27T19:16:52","date_gmt":"2019-09-27T11:16:52","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=5045"},"modified":"2019-09-27T19:16:54","modified_gmt":"2019-09-27T11:16:54","slug":"pidof","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/pidof","title":{"rendered":"pidof\u547d\u4ee4 – \u8fd4\u56de\u8fd0\u884c\u7a0b\u5e8f\u7684\u8fdb\u7a0bID"},"content":{"rendered":"\n

pidof\u547d\u4ee4\u7528\u4e8e\u68c0\u7d22\u6307\u5b9a\u7684\u547d\u4ee4\uff0c\u8fd4\u56de\u76f8\u5e94\u7684\u8fdb\u7a0bID\u3002\u5176\u4e2dprogram\u662f\u4e00\u4e2a\u6216\u591a\u4e2a\u547d\u4ee4\u6216\u8fdb\u7a0b\u7684\u540d\u5b57\u3002\u5f53\u9700\u8981\u7ec8\u6b62\u67d0\u4e2a\u8fdb\u7a0b\u65f6\uff0c\u4f20\u7edf\u7684\u505a\u6cd5\u662f\u5229\u7528ps\u547d\u4ee4\u5217\u51fa\u6240\u6709\u7684\u8fdb\u7a0b\uff0c\u4f7f\u7528grep\u547d\u4ee4\u9009\u51fa\u76ee\u6807\u8fdb\u7a0b\uff0c\u7136\u540e\u4f7f\u7528kill\u547d\u4ee4\u7ec8\u6b62\u8fdb\u7a0b\u3002<\/p>\n\n\n\n

\u5229\u7528pidof\u547d\u4ee4\uff0c\u53ef\u4ee5\u7701\u7565ps\u4e0egrep\u7ec4\u5408\u547d\u4ee4\uff0c\u76f4\u63a5\u628a\u6307\u5b9a\u547d\u4ee4\u7684\u8fdb\u7a0bID\u5199\u5165\u5230\u6807\u51c6\u8f93\u51fa\u3002<\/p>\n\n\n\n

\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>pidof [\u53c2\u6570] <\/p>\n\n\n\n

\u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n
-s<\/td>\u5f53\u7cfb\u7edf\u4e2d\u5b58\u5728\u591a\u4e2a\u540c\u540d\u8fdb\u7a0b\u65f6\uff0c\u4ec5\u8fd4\u56de\u4e00\u4e2a\u8fdb\u7a0bID<\/td><\/tr>
-c<\/td>\u4ec5\u8fd4\u56de\u5f53\u524d\u6b63\u5728\u8fd0\u884c\u4e14\u5177\u6709\u540c\u4e00\u6839\u76ee\u5f55\u7684\u8fdb\u7a0bPID<\/td><\/tr>
-x<\/td>\u8fd4\u56de\u6307\u5b9a\u8fd0\u884c\u811a\u672c\u7684shell\u8fdb\u7a0bPID<\/td><\/tr>
-o<\/td>\u5ffd\u7565\u5177\u6709\u6307\u5b9a\u8fdb\u7a0bID\u7684\u8fdb\u7a0b<\/td><\/tr><\/tbody><\/table>\n\n\n\n

\u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n

\u8fd4\u56decrond\u5b88\u62a4\u8fdb\u7a0b\u7684PID\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# pidof crond<\/pre>\n\n\n\n

\u8fd4\u56deApache\u670d\u52a1\u5668\u5b88\u62a4\u8fdb\u7a0bhttpd\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# pidof httpd<\/pre>\n","protected":false},"excerpt":{"rendered":"

pidof\u547d\u4ee4\u7528\u4e8e\u68c0\u7d22\u6307\u5b9a\u7684\u547d\u4ee4\uff0c\u8fd4\u56de\u76f8\u5e94\u7684\u8fdb\u7a0bID\u3002\u5176\u4e2dprogram\u662f\u4e00\u4e2a\u6216\u591a\u4e2a\u547d\u4ee4\u6216\u8fdb\u7a0b\u7684\u540d\u5b57\u3002\u5f53\u9700\u8981\u7ec8 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/5045"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=5045"}],"version-history":[{"count":4,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/5045\/revisions"}],"predecessor-version":[{"id":5102,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/5045\/revisions\/5102"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=5045"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=5045"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=5045"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}