How to find out what processes are listening on specific ports in Ubuntu?
Asked
Active
Viewed 345 times
5 Answers
7
Assuming that you are root.
netstat -lnp
The 4th and 7th fields are what you want.
Alternatively you can get much more detailed information with lsof(1).

Dan Carley
- 25,617
- 5
- 53
- 70
3
lsof -i :<port #>

TCampbell
- 2,024
- 14
- 14
-
1This will show only processes owned by user. So, unless you're logged in as root, prepend sudo. – xyz Aug 03 '09 at 12:57
0
This works pretty well for me on linux only:
netstat -anp|egrep -i 'PID/Program|LISTEN'
-a = All sockets -n = doNt resolve IPs -p = show Pids/Programs associated with each

ericslaw
- 1,572
- 2
- 13
- 15