How do I find out running processes were associated with each open port? How do I find out what process has open tcp port 111 or udp port 7000 under Linux?
You can the following programs to find out about port numbers and its associated process:
- netstat – a command-line tool that displays network connections, routing tables, and a number of network interface statistics.
- fuser – a command line tool to identify processes using files or sockets.
- lsof – a command line tool to list open files under Linux / UNIX to report a list of all open files and the processes that opened them.
- /proc/$pid/ file system – Under Linux /proc includes a directory for each running process (including kernel processes) at /proc/PID, containing information about that process, notably including the processes name that opened port.
You must run above command(s) as the root user.
Type the following command:
# netstat -tulpn