Skip to content

Instantly share code, notes, and snippets.

@Drewlius
Created September 18, 2026 14:27
Show Gist options
  • Select an option

  • Save Drewlius/8bbbb93ba6c45bf4e73a27e5800b8839 to your computer and use it in GitHub Desktop.

Select an option

Save Drewlius/8bbbb93ba6c45bf4e73a27e5800b8839 to your computer and use it in GitHub Desktop.
title Trace a Listening Port to an Application
tags
linux
networking
troubleshooting
how-to
aliases
Port to Process Mapping
created 2026-07-03

Trace a Listening Port to an Application

Using ss (modern, recommended)

# Show all listening TCP/UDP ports with process info
ss -tulpn

# For a specific port
ss -tulpn | grep :8080

Using netstat (legacy)

# Show listening ports with PID/Program name
sudo netstat -tulpn

# For specific port
sudo netstat -tulpn | grep :8080

Using lsof

# Show process using a specific port
sudo lsof -i :8080

# Show all internet connections
sudo lsof -i

Using fuser

# Identify process using a port
fuser 8080/tcp

Example Output Interpretation

tcp   LISTEN  0  128  0.0.0.0:8080  0.0.0.0:*  users:(("nginx",pid=1234,fd=6))
  • tcp/udp: Protocol
  • LISTEN: State (listening for connections)
  • 0.0.0.0:8080: Binding address and port
  • nginx: Process name
  • pid=1234: Process ID
  • fd=6: File descriptor

Quick One-Liners

# Find what's on port 8080 (any tool available)
sudo ss -tulpn | grep :8080 || sudo netstat -tulpn | grep :8080 || sudo lsof -i :8080

# Kill process on port
sudo kill -9 $(sudo lsof -t -i :8080)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment