Inspecting Network Connections and Sockets
Use modern Linux tools to list open ports, active connections, and the processes behind them so you can understand what your machine is talking to.
Inspecting Network Connections and Sockets is a free Linux Networking & TCP/IP for Developers lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Linux Networking & TCP/IP for Developers learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Why Inspect Connections?
Knowing which ports are open and which connections are live is key to debugging services, catching unexpected traffic, and confirming an app listens where you expect.
Meet ss
The modern tool for socket inspection is ss (socket statistics). It replaces older netstat and runs far faster on busy systems.
ssListening Ports
To see what's listening, stack flags: -l listening, -t TCP, -u UDP, -n numeric. Together: ss -tuln.
ss -tulnWhich Process Owns a Port
Add -p to reveal the process behind each socket — the fast answer to "what is using port 8080?"
sudo ss -tulnpActive Connections
Drop -l to see established connections instead of listeners — who your machine is actually talking to right now.
ss -tn state establishedFiltering by Port
ss takes powerful filters. Target a single port — like :443 — to focus only on HTTPS traffic.
ss -tn dport = :443Connection States
TCP sockets cycle through states like LISTEN, ESTABLISHED, TIME-WAIT, and CLOSE-WAIT. Plenty of CLOSE-WAIT often means an app isn't closing sockets.
Counting Connections
Pipe ss into wc -l to count connections — a quick way to spot connection leaks or rising load.
ss -tn state established | wc -lQuick Port Check With lsof
lsof lists open files, including network sockets. Run sudo lsof -i :8080 for a fast, targeted per-port lookup.
sudo lsof -i :8080Summary Statistics
ss -s prints a one-line summary of socket counts by type and state — a fast health glance for a server.
ss -sResolving Names
Drop the -n and ss resolves host and service names — friendlier to read, but slower on busy hosts.
ss -tuQuick Check
Test your socket-inspection knowledge.
Recap
Recap: ss is the fast modern tool — ss -tuln lists listeners, -p finds owning processes, and lsof -i gives quick per-port lookups.
Frequently asked questions
Is the “Inspecting Network Connections and Sockets” lesson free?
Yes — the full text of “Inspecting Network Connections and Sockets” is free to read here on the web, and the Linux Networking & TCP/IP for Developers course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Linux Networking & TCP/IP for Developers course, upgrade to CoddyKit PRO.
What will I learn in “Inspecting Network Connections and Sockets”?
Use modern Linux tools to list open ports, active connections, and the processes behind them so you can understand what your machine is talking to. You practise Linux Networking & TCP/IP for Developers with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Linux Networking & TCP/IP for Developers?
No prior experience is required. Linux Networking & TCP/IP for Developers on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Inspecting Network Connections and Sockets” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Linux Networking & TCP/IP for Developers lesson?
Yes. Every Linux Networking & TCP/IP for Developers lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Linux Network Essentials
- Basic Network Commands
- Network Interfaces & IP
- Inspecting Network Connections and Sockets