How could I tell what is listening on which ports on Ubuntu? In other words, how do I get a list of ports that are in use?
1 Answer
"In use" as in with an active connection, or that programs are listening on? Or both?
Run sudo netstat -lp
in your terminal; this will tell you what ports are open to receive connections, and what programs are listening on them. Try sudo netstat -p
for the same thing, plus currently-active connections.
-
-
What was a little strange is that I have tomcat and apache servers running and neither port 8080 nor 80 showed up in the list. Would you know why that would happen? Apr 19, 2011 at 18:02
-
@Genadinik Verify what port they are configured to listen on; for Apache this is the Listen directive in its config file, but I don't know about Tomcat.– KromeyApr 19, 2011 at 18:06
-
11
fuser -n tcp 8080
will approach it from the other end; showing you which process (if any) is listening on TCP port 8080. Apr 19, 2011 at 18:12 -
If what Kromey suggested didn't cut it, try
sudo netstat -tulpn
. Jul 14, 2020 at 21:36