Skip to content
Advertisement

netstat commands to run on unix server, what commands should I use for my use-case and why?

Sorry in advance for such a noob question, but I’m certainly a noob. My question is what does it mean to LISTEN or ACCEPT on a port as it relates to my example?

EXAMPLE: I have a tomcat server, and It will use port 8080. I want to make sure that port is available for me to use.

What commands should I perform on my unix server and why?

what information would a command like this give me: netstat -an | grep LISTEN

Advertisement

Answer

If a port shows up as LISTEN in netstat, it means the port is in use by a server process, so you can’t use it. Here is an example:

tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN

which shows that port 631 is in use.

Ignore the UNIX type sockets at the end – they are irrelevant.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement