{"id":286,"date":"2023-02-24T21:48:01","date_gmt":"2023-02-24T13:48:01","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=286"},"modified":"2023-04-30T15:12:58","modified_gmt":"2023-04-30T07:12:58","slug":"summary-of-process-and-port-query-under-linux","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/24\/summary-of-process-and-port-query-under-linux\/","title":{"rendered":"Linux\u4e0b\u8fdb\u7a0b\u53ca\u7aef\u53e3\u67e5\u8be2\u6c47\u603b"},"content":{"rendered":"<h3>\u6839\u636e\u7aef\u53e3\u67e5\u8fdb\u7a0b<\/h3>\n<pre><code>lsof -i:port\nnetstat -nap | grep port<\/code><\/pre>\n<p><!-- more --><\/p>\n<h3>\u6839\u636e\u8fdb\u7a0b\u53f7\u67e5\u7aef\u53e3<\/h3>\n<pre><code>lsof -i | grep pid\nnetstat -nap | grep pid<\/code><\/pre>\n<h3>\u6839\u636e\u8fdb\u7a0b\u540d\u67e5\u627epid\u3001port<\/h3>\n<pre><code>ps -ef | grep tomcat\nps -ef | grep pid<\/code><\/pre>\n<h3>netstat\u65e0\u6cd5\u663e\u793aPID\u6216\u8fdb\u7a0b\u540d<\/h3>\n<pre><code>$ netstat -nap | grep 8080\n(Not all processes could be identified, non-owned process info\n will not be shown, you would have to be root to see it all.)\ntcp6       0      0 :::8080                 :::*                    LISTEN      -                   <\/code><\/pre>\n<p>\u6267\u884c<code>netstat -anop<\/code>\u540e\u5f97\u5230\u5982\u4e0a\u7ed3\u679c\uff0c\u6709\u4e9b\u7aef\u53e3\u5360\u7528\u6ca1\u6709\u8fdb\u7a0b\u7684pid\u548cProgram Name\uff0c\u4f7f\u7528root\u6267\u884c\u5373\u53ef<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6839\u636e\u7aef\u53e3\u67e5\u8fdb\u7a0b lsof -i:port netstat -nap | grep port \u6839\u636e\u8fdb\u7a0b\u53f7\u67e5\u7aef\u53e3  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-286","post","type-post","status-publish","format-standard","hentry","category-devops-base"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/286","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=286"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/286\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=286"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=286"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=286"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}