Linux - How to know which program take a port ?

About

When you install software, you need often to verify the available port in order to configure the component installation.

Articles Related

How can I know which ports are available ?

To find available port numbers, on the server, you should, on UNIX, inspect the services file (The services translation file), located at:

/etc/services

How to know which program use a port?

Below an example for the port 1521, we can see that the program tnslsnr use this port.

[oracle@oel11g ~]$ netstat -tulpn|grep 1521
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
 
Protocol   Recv-Q Send-Q  Local Address     Foreign Address     State
tcp        0      0       :::1521           :::*                LISTEN      4264/tnslsnr

where:

  • The protocol (tcp, udp, raw) used by the socket.
  • Recv-Q: The count of bytes not copied by the user program connected to this socket.
  • Send-Q The count of bytes not acknowledged by the remote host.
  • Local Address: Address and port number of the local end of the socket. Unless the –numeric (-n) option is specified, the socket address is resolved to its canonical host name (FQDN), and the port number is translated into the corresponding service name.
  • Foreign Address: Address and port number of the remote end of the socket. Analogous to “Local Address.”
  • State: The state of the socket (ESTABLISHED, LISTEN, …)
  • PID/Program name: Slash-separated pair of the process id (PID) and process name of the process that owns the socket.
  • Bookmark "Linux - How to know which program take a port ?" at del.icio.us
  • Bookmark "Linux - How to know which program take a port ?" at Digg
  • Bookmark "Linux - How to know which program take a port ?" at Ask
  • Bookmark "Linux - How to know which program take a port ?" at Google
  • Bookmark "Linux - How to know which program take a port ?" at StumbleUpon
  • Bookmark "Linux - How to know which program take a port ?" at Technorati
  • Bookmark "Linux - How to know which program take a port ?" at Live Bookmarks
  • Bookmark "Linux - How to know which program take a port ?" at Yahoo! Myweb
  • Bookmark "Linux - How to know which program take a port ?" at Facebook
  • Bookmark "Linux - How to know which program take a port ?" at Yahoo! Bookmarks
  • Bookmark "Linux - How to know which program take a port ?" at Twitter
  • Bookmark "Linux - How to know which program take a port ?" at myAOL
 
linux/port.txt · Last modified: 2011/06/18 16:21 by gerardnico