在 netstat 中获取不完整的输出

在 netstat 中获取不完整的输出

Apache tomcat 正在端口 8080 上运行,但netstat -tlnp不显示它,而是其输出被二进制字符截断:

# netstat -tlnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name   
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      1422/mysqld         
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      829/smbd            
tcp        0      0 127.0.0.1:5939          0.0.0.0:*               LISTEN      962/dnsmasq         
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1097/sshd           
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      5584/cupsd          
tcp        0      0 127.0.0.1:2812          0.0.0.0:*               LISTEN      829/smbd            
tcp        0      0 0.0.0.0:5666            0.0.0.0:*               LISTEN      1334/nrpe           
�root@server:~# 

检查时lsof了解运行进程:

# lsof -n -i tcp:8080
COMMAND PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
java    959 tomcat   47u  IPv6  15556      0t0  TCP *:http-alt (LISTEN)

这就是它的开始方式:

# cat /proc/959/cmdline
/usr/lib/jvm/java-8-oracle/bin/java-Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager-Djava.awt.headless=true-Djava.security.egd=file:/dev/./urandom-Djdk.tls.ephemeralDHKeySize=2048-Djava.protocol.handler.pkgs=org.apache.catalina.webresources-Xms512M-Xmx1024M-server-XX:+UseParallelGC-Djava.endorsed.dirs=/opt/tomcat/endorsed-classpath/opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar-Dcatalina.base=/opt/tomcat-Dcatalina.home=/opt/tomcat-Djava.io.tmpdir=/opt/tomcat/temporg.apache.catalina.startup.Bootstrapstart

发行版是 Ubuntu 14.04,netstat 版本是:

# netstat -V
net-tools 1.60
netstat 1.42 (2001-04-15)

相关内容