Home > OS >  Lsof let it does not display the server name, directly show the port number
Lsof let it does not display the server name, directly show the port number

Time:10-19

Everybody is good, the following result, want to let the results don't display webcache, and directly show 8080, need to add to the parameters? Thank you very much!

/root @ TSP - YZ - MQAPROD ~ # ps - ef | grep tomcat
Root 4079 2930 0 now PTS/0 00:00:00 grep tomcat
22951 1 0 09:33 root? 00:00:15/usr/java/jdk1.6.0_33/bin/java -Djava.util.logging.config.file=/opt/apache-tomcat-7.0.29/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/opt/apache-tomcat-7.0.29/endorsed -classpath/opt/apache-tomcat-7.0.29/bin/bootstrap.jar:/opt/apache-tomcat-7.0.29/bin/tomcat-juli.jar -Dcatalina.base=/opt/apache-tomcat-7.0.29 -Dcatalina.home=/opt/apache-tomcat-7.0.29 -Djava.io.tmpdir=/opt/apache-tomcat-7.0.29/temp org.apache.catalina.startup.Bootstrap start
/root @ TSP - YZ - MQAPROD ~ # lsof -p 22951 | grep LISTEN
Java 22951 root 38 u IPv6 320990073 0 t0 TCP * : webcache (LISTEN)
Java 22951 root 40 u IPv6 320990074 0 t0 TCP * : 8009 (LISTEN)
Java 22951 root 62 u IPv6 TCP localhost: 320990233 0 t0 mxi (LISTEN)
/root @ TSP - YZ - MQAPROD ~ #

CodePudding user response:

Continue to use the awk processing

CodePudding user response:

According to the practice should be a -n parameter,

CodePudding user response:

The lsof -p 22951 | grep LISTEN | grep -v webcache

CodePudding user response:

Thanks for your reply, see the man under the manual, as if does not support direct port number, indicating the name of the service

CodePudding user response:

reference 1st floor alinly response:
continue to use the awk processing

How at the end of the handle?

CodePudding user response:

refer to the second floor NSWCFD response:
the customary should have a -n parameter,

- n just not to DNS, and this is not the same,

CodePudding user response:

You can go to/etc/services inside to remove the 8080
There is a command, ss, but this can't specify the pid

CodePudding user response:

To achieve this effect can use the
Netstat nutlp | grep LISTEN. * 22951

CodePudding user response:

-p

The lsof - I - P

CodePudding user response:

 
The lsof - P - P 22951 | grep LISTEN
  • Related