Linux下Tomcat埠號以及程序相關命令
阿新 • • 發佈:2018-11-16
1. 檢視tomcat程序
ps -aux | grep tomcat
(或者ps -ef | grep tomcat都行)
[plain] view plain copy
- root 1537 0.1 3.7 12829256 1248140 ? Sl Oct13 <span style="font-family: Arial, Helvetica, sans-serif;">...(這裡其它內容省略)</span>
- tomcat7 14177 1.3 0.3 3202376 124332 ? Sl 10:02 <span style="font-family: Arial, Helvetica, sans-serif;">...(這裡其它內容省略)</span>
- ...
可以看到現在執行著兩個tomcat程序,一個程序的pid為1537,另一個pid為14177。
2. 根據程序檢視埠號
sudo netstat -naop | grep 14177
這是檢視pid為14177的程序佔用的埠號
[plain] view plain copy
- tcp6 0 0 127.0.0.1:8055 :::* LISTEN 14177/java off (0.00/0/0)
- tcp6 0 0 :::8088 :::* LISTEN 14177/java off (0.00/0/0)
- unix 2 [ ] STREAM CONNECTED 60122 14177/java
可以看到8055和8088埠號被佔用,其中805是tomact Server的SHUTDOWN的埠號,8088是tomcat的CATALINA Service的Connector的埠號。