Linux工作筆記027---Centos7.3 檢視tomcat所佔用的埠號
阿新 • • 發佈:2018-12-27
看看下面的圖就搞定了,執行兩個命令,先找到tomcat的pid,然後,根據pid找到埠
可以這樣看:
1、先檢視tomcat的程序號
ps -ef | grep tomcat*
後面帶*號,是為了檢視多個tomcat,例如tomcat6,tomcat7。
2、根據程序號檢視埠號
netstat -anop | grep 15161
可以看到8865、8866、8867埠號被佔用
3、此外,還可以通過埠號,檢視其所屬的程序號相關資訊
lsof -i: 8866
Last login: Sat Sep 15 02:36:46 2018 from 172.21.73.1
[ [email protected] ~]# ps -ef|grep tomcat
root 9386 1 0 01:50 ? 00:00:17 /lib/jvm/jre/bin/java -Djava.util.logging.config.file=/opt/tomca/apache-tomcat-8.0.46/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Djava.endorsed.dirs=/opt/tomcat/apache-tomcat-8.0.46/endorsed -classpath /opt/tomcat/apache-tomcat-8.0.46/bin/bootstrap.jar:/opt/tomcat/apache-tomcat-8.0.46/bin/tomcat-juli.jar -Dcatalina.base=/opt/tomcat/apache-tomcat-8.0.46 -Dcatalina.home=/opt/tomcat/apache-tomcat-8.0.46 -Djava.io.tmpdir=/opt/tomcat/apache-tomcat-8.0.46/temp org.apache.catalina.startup.Bootstrap start
root 11514 11460 0 03:25 pts/1 00:00:00 grep --color=auto tomcat
[ [email protected] ~]# netstat -anop|grep 9386
tcp6 0 0 127.0.0.1:8005 :::* LISTEN 9386/java off (0.00/0/0)
tcp6 0 0 :::8009 :::* LISTEN 9386/java off (0.00/0/0)
tcp6 0 0 :::8088 :::* LISTEN 9386/java off (0.00/0/0)
unix 2 [ ] STREAM CONNECTED 34054 9386/java
unix 2 [ ] STREAM CONNECTED 37227 9386/java
[ [email protected] ~]#