0

How to find out what processes are listening on specific ports in Ubuntu?

Alex
  • 2,357
  • 5
  • 32
  • 41

5 Answers5

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
  • 1
    This will show only processes owned by user. So, unless you're logged in as root, prepend sudo. – xyz Aug 03 '09 at 12:57
2

best way i know of is:

netstat -lpn

run as super user

goose
  • 151
  • 7
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
0

su -c netstat -lpna

Rajat
  • 3,349
  • 22
  • 29