Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a way to determine what process is using a port?

Status
Not open for further replies.

RobJordan

MIS
Apr 3, 2001
296
US
I found a utility called lsof which will display
the process name and id information, but I was wondering if there was another way to find it as lsof does not always work.

# ./lsof -V|grep TCP|grep LISTEN
rpcbind 607 root 7u inet 72,0x72 0t0 TCP *:portmap (LISTEN)
sendmail: 906 root 5u inet 0x43a16e68 0t0 TCP *:smtp (LISTEN)

For example this is what a I get from a netstat command,
but it does not show what process name or pid that using port 5244.

# netstat -an|grep 5244
tcp 0 0 *.5244 *.* LISTEN

Thanks in advance,

Robert
 
The way to use lsof to see what is using port 5244 is

lsof -i :5244

or (as you did)

lsof -i | grep LISTEN

Are you perhaps confused by the case where nothing is really happening (yet) except inetd listening on the port (as may be in the example you gave)? Tony Lawrence
SCO Unix/Linux Resources tony@pcunix.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top