pidof<\/code>\u3002\u4e0b\u9762\u5c06\u4ecb\u7ecd\u8fd9\u4e9b\u547d\u4ee4\u7684\u7528\u6cd5\u3002<\/p>\n\u4f7f\u7528ps\u547d\u4ee4\u67e5\u770b\u8fdb\u7a0bID<\/h2>\n
ps\u547d\u4ee4\u662f\u4e00\u79cd\u7528\u4e8e\u663e\u793a\u5f53\u524d\u8fd0\u884c\u8fdb\u7a0b\u7684\u5de5\u5177\u3002\u901a\u8fc7ps\u547d\u4ee4\uff0c\u7528\u6237\u53ef\u4ee5\u67e5\u770b\u7cfb\u7edf\u4e2d\u8fd0\u884c\u7684\u5404\u79cd\u8fdb\u7a0b\u4ee5\u53ca\u5b83\u4eec\u7684\u8fdb\u7a0bID\u3001\u72b6\u6001\u7b49\u4fe1\u606f\u3002<\/p>\n
ps\u547d\u4ee4\u7684\u57fa\u672c\u7528\u6cd5<\/h3>\n
\u8981\u67e5\u770b\u6240\u6709\u8fdb\u7a0b\u7684\u8fdb\u7a0bID\uff0c\u53ef\u4ee5\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n
ps -e -o pid,cmd<\/code><\/pre>\n \u4f7f\u7528pgrep\u548cpidof\u547d\u4ee4\u67e5\u627e\u8fdb\u7a0bID<\/h3>\n
\u9664\u4e86ps\u547d\u4ee4\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528pgrep\u548cpidof\u547d\u4ee4\u6765\u67e5\u627e\u67d0\u4e2a\u7279\u5b9a\u8fdb\u7a0b\u7684\u8fdb\u7a0bID\u3002\u8fd9\u4e24\u4e2a\u547d\u4ee4\u53ef\u4ee5\u6839\u636e\u8fdb\u7a0b\u7684\u540d\u5b57\u67e5\u627e\u5bf9\u5e94\u7684\u8fdb\u7a0bID\u3002<\/p>\n
pgrep\u547d\u4ee4\u7528\u6cd5<\/h3>\n
\u8981\u67e5\u627e\u7279\u5b9a\u8fdb\u7a0b\u540d\u5b57\u5bf9\u5e94\u7684\u8fdb\u7a0bID\uff0c\u53ef\u4ee5\u4f7f\u7528pgrep\u547d\u4ee4\u3002\u4f8b\u5982\uff0c\u67e5\u627e\u540d\u4e3a”firefox”\u7684\u8fdb\u7a0bID\uff1a<\/p>\n
pgrep firefox<\/code><\/pre>\n pidof\u547d\u4ee4\u7528\u6cd5<\/h3>\n
\u4e0epgrep\u7c7b\u4f3c\uff0cpidof\u547d\u4ee4\u4e5f\u53ef\u4ee5\u6839\u636e\u8fdb\u7a0b\u540d\u5b57\u67e5\u627e\u5bf9\u5e94\u7684\u8fdb\u7a0bID\u3002\u4f8b\u5982\uff0c\u67e5\u627e\u540d\u4e3a”apache2″\u7684\u8fdb\u7a0bID\uff1a<\/p>\n
pidof apache2<\/code><\/pre>\n\u603b\u7ed3<\/h2>\n
\u672c\u6587\u4ecb\u7ecd\u4e86\u8fdb\u7a0bID\u7684\u6982\u5ff5\u4ee5\u53ca\u5728Ubuntu\u7cfb\u7edf\u4e2d\u5982\u4f55\u67e5\u770b\u8fdb\u7a0bID\u3002<\/strong>\u901a\u8fc7ps\u3001pgrep\u548cpidof\u7b49\u547d\u4ee4\uff0c\u7528\u6237\u53ef\u4ee5\u65b9\u4fbf\u5730\u7ba1\u7406\u7cfb\u7edf\u8fdb\u7a0b\uff0c\u5e76\u6839\u636e\u9700\u8981\u8fdb\u884c\u64cd\u4f5c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u672c\u6587\u5c06\u4ecb\u7ecd\u5728Ubuntu\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u5982\u4f55\u67e5\u770b\u8fdb\u7a0bID\uff0c\u4ee5\u53ca\u76f8\u5173\u6982\u5ff5\u548c\u64cd\u4f5c\u65b9\u6cd5\u3002\u4e86\u89e3\u5982\u4f55\u67e5\u770b\u8fdb\u7a0bID\u53ef\u4ee5\u5e2e\u52a9\u7528\u6237\u66f4\u597d\u5730\u7ba1\u7406\u7cfb\u7edf\u8fdb\u7a0b\uff0c\u63d0\u9ad8\u64cd\u4f5c\u6548\u7387\u3002\u8fdb\u7a0b\u548c\u8fdb\u7a0bID\u7684\u6982\u5ff5<\/p>\n","protected":false},"author":1,"featured_media":64183,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":""},"categories":[36],"tags":[305],"class_list":["post-76123","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-dzjs"],"_links":{"self":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/76123","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/comments?post=76123"}],"version-history":[{"count":0,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/76123\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media\/64183"}],"wp:attachment":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media?parent=76123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/categories?post=76123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/tags?post=76123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}