Open Ports: Find Which Program Uses Them in Linux

Quick Linux Tip #91:

Question: I see unexpected open ports. What program is behind each one?

Try: sudo ss -tulnp

Info: ss flags: -t=TCP, -u=UDP, -l=listening, -n=numeric, -p=processes. Displays active listening sockets alongside process names, PIDs, and file descriptors.

Examples:

  • $ sudo ss -tulnp | grep :80  # Filter for specific port bindings
  • $ sudo ss -tnp state established  # Identify active inbound and outbound connections
  • $ sudo lsof -iTCP -sTCP:LISTEN -P -n  # Alternative open port diagnostic using lsof

Note: Replaces legacy netstat -tulnp. Bindings on 127.0.0.1 restrict access to localhost, while 0.0.0.0 exposes services publicly.




LinuxTeck.com
linuxteck:~$ sudo ss -tulnp
Netid State      Recv-Q Send-Q      Local Address:Port    Peer Address:Port Process
udp   UNCONN     0      0           127.0.0.53%lo:53      0.0.0.0:*     users:(("systemd-resolve",pid=890,fd=14))
udp   UNCONN     0      0           10.0.0.5:68           0.0.0.0:*     users:(("NetworkManager",pid=1023,fd=27))
tcp   LISTEN     0      128         0.0.0.0:22            0.0.0.0:*     users:(("sshd",pid=1245,fd=3))
tcp   LISTEN     0      511         0.0.0.0:80            0.0.0.0:*     users:(("nginx",pid=2341,fd=6))
tcp   LISTEN     0      511         0.0.0.0:443           0.0.0.0:*     users:(("nginx",pid=2341,fd=7))
tcp   LISTEN     0      128         127.0.0.1:3306        0.0.0.0:*     users:(("mysqld",pid=3456,fd=22))
tcp   LISTEN     0      128         127.0.0.1:6379        0.0.0.0:*     users:(("redis-server",pid=4567,fd=6))
linuxteck:~$

PREVIOUS ARTICLE Quick Linux Tip #90: DNS Lookup Time: Measure Network Latency with curl NEXT ARTICLE Quick Linux Tip #92: Core Dump: Analyze a Running Process with gcore
About John Britto

John Britto Founder & Chief-Editor @LinuxTeck. A Computer Geek and Linux Intellectual having more than 20+ years of experience in Linux and Open Source technologies.

View all posts by John Britto →

Leave a Reply

Your email address will not be published.