Linux: Identificando qual processo esta escutando uma porta tcpip: Difference between revisions

From Wiki
 
(One intermediate revision by the same user not shown)
Line 51: Line 51:
*[[Linux:Comando Xargs]]
*[[Linux:Comando Xargs]]
*[[Linux e Unix: Ferramentas de Monitoracao e Performance]]
*[[Linux e Unix: Ferramentas de Monitoracao e Performance]]


*[[Linux|  Mais Artigos sobre Linux / UNIX / AIX]]
*[[Linux|  Mais Artigos sobre Linux / UNIX / AIX]]
Line 58: Line 59:
[[Category:Linux Shell]]
[[Category:Linux Shell]]
[[Category:Linux Tunning]]
[[Category:Linux Tunning]]
[[Category:lsof]]
[[Category:netstat]]

Latest revision as of 11:31, 13 September 2016

Qual processo está escutando uma porta tcpip?

Pergunta bastante comum, não.

Veja abaixo alguma maneiras

Usando o comando netstat

# netstat -anp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 127.0.0.1:9632              0.0.0.0:*                   LISTEN      24543/java          
tcp        0      0 0.0.0.0:835                 0.0.0.0:*                   LISTEN      2349/rpc.statd      
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      24543/httpd          
...      
tcp        0      0 0.0.0.0:9352                0.0.0.0:*                   LISTEN      24543/java          
tcp        0      0 172.24.32.89:9354           172.24.32.89:57642          TIME_WAIT   -                   
tcp        0      0 127.0.0.1:9632              127.0.0.1:38656             ESTABLISHED 24543/java         


# netstat -anp | grep :80
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      24543/httpd          

OU

# netstat aon

OU

# netstat -nlp


Usando o comando lsof

# lsof -i :22
COMMAND  PID USER   FD   TYPE DEVICE SIZE NODE NAME
sshd    2473 root    3u  IPv4   6798       TCP *:ssh (LISTEN)

OU

# lsof -i tcp:22
COMMAND  PID USER   FD   TYPE DEVICE SIZE NODE NAME
sshd    2473 root    3u  IPv4   6798       TCP *:ssh (LISTEN)


Ver também