How to Quickly Identify Which Process Is Using a Port on Linux
This guide explains how to use Linux commands such as netstat, ss, lsof, fuser, and nmap to inspect port usage, interpret their output fields, and install missing tools, enabling you to pinpoint which processes are occupying specific ports.
Linux Port Usage Inspection
Install required tools if they are missing:
yum install -y net-tools lsof psmisc1. netstat or ss command
Using netstat: netstat -anlp | grep 8888 Option explanations: -t: show TCP ports -u: show UDP ports -l: display listening sockets only -p: show PID and program name -n: skip DNS resolution for faster output
Key columns in the output:
Proto : protocol (tcp or udp)
Recv‑Q : bytes waiting to be read by the process
Send‑Q : bytes waiting to be sent or acknowledged
Local Address : IP and port on the local machine (e.g., 0.0.0.0:22 for all IPv4, :::22 for all IPv6, 127.0.0.1:9100 for loopback only)
Foreign Address : remote IP and port
State : connection state such as LISTEN, ESTABLISHED, UNKNOWN
PID/Program : owning process ID and name
Typical state values:
LISTEN: listening for incoming connections
ESTABLISHED: active data exchange
UNKNOWN: unrecognized socket state2. ss command
Alternative to netstat:
ss -anlp | grep 803. lsof command
Lists open files and the processes that own them, useful for ports:
lsof -i:804. fuser command
Shows which process is using a specific file or socket (ports are treated as files):
fuser 22/tcp -v5. nmap tool
Scans local ports quickly:
nmap localhostSigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
