Linux - Quelle application utilise le port 8080

Linux - Quelle application utilise le port 8080

Les développeurs Java doivent toujours savoir quelle application utilise le port 8080 très demandé. Dans ce didacticiel, nous allons vous montrer deux façons de savoir quelle application utilise le port 8080 sous Linux.

1. Commande lsof + ps

1.1 Bring up the terminal, type lsof -i :8080

$ lsof -i :8080

COMMAND   PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
java    10165 example   52u  IPv6 191544      0t0  TCP *:http-alt (LISTEN)

Note
Si résultat multiple, essayezlsof -i :8080 | grep LISTEN

1.2 PID 10165 is using port 8080, type ps -ef | grep 10165 to find out the application details.

$ ps -ef | grep 10165

example   10165  4364  1 11:58 ?        00:00:20 /opt/jdk/jdk1.8.0_66/jre/bin/java
//...
-Djava.endorsed.dirs=/home/example/software/apache-tomcat-8.0.30/endorsed
-classpath /home/example/software/apache-tomcat-8.0.30/bin/bootstrap.jar:
/home/example/software/apache-tomcat-8.0.30/bin/tomcat-juli.jar
-Dcatalina.base=/home/example/.IntelliJIdea15/system/tomcat/Unnamed_hc_2
-Dcatalina.home=/home/example/software/apache-tomcat-8.0.30
-Djava.io.tmpdir=/home/example/software/apache-tomcat-8.0.30
/temp org.apache.catalina.startup.Bootstrap start

Answer: IntelliJ IDEA + Tomcat 8 utilise le port 8080.

2. commande netstat + ps

Commande juste différente pour faire la même chose. Tapeznetstat -nlp | grep 8080 pour obtenir le PID etps il.

$ netstat -nlp | grep 8080

(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp6       0      0 :::8080                 :::*                    LISTEN      10165/java

$ ps -ef | grep 10165

example   10165  4364  1 11:58 ?        00:00:20 /opt/jdk/jdk1.8.0_66/jre/bin/java
//...