Check port status on CentOS

12,935

Solution 1

First, you can use netstat to see state of port.

Second, you can use tcpdump to see traffic going in and out on that port.

tcpdump -i eth0 "port 5004" 

reports traffic on eth0 to port 5004.

Solution 2

You can use lsof -i :5004 to see if any process has that port open. Alternately, if you're not sure about the port in use but do know the process that is listening, you can use lsof -p process_id to find the port.

Share:
12,935

Related videos on Youtube

zozo
Author by

zozo

Updated on September 17, 2022

Comments

  • zozo
    zozo almost 2 years

    I have a CentOS machine, and I opened a port on witch I should get a stream (actually it is the 5004 port - rtp). However, seems like the stream is not received.

    Is there anyway to check on status of a port? (I mean not on/of... but if anything is received).

  • sciurus
    sciurus about 13 years
    I'm curious why this was downvoted; I still believe it is worth checking if the port is in use by the expected program. If it is, then moving on to tcpdump is appropriate.