What it is
ps lists running processes with their PIDs, owners, and commands. Tools like ss -tulnp or lsof -i show which process owns each listening TCP/UDP socket. Service managers (systemctl) control lifecycle and configuration reloads, while logs explain why a bound process rejects traffic.
Why you need it
Knowing that a daemon crashed—or that a stale process already occupies port 8080—turns blind restarts into evidence-based recovery.
How it works
- List active processes with ps -ef or ps aux to find PIDs and owners.
- Check listening sockets and owning PIDs with ss -tulnp or lsof -i.
- Inspect recent error logs with tail -n 20 before killing or restarting anything.
- Stop conflicting processes gracefully (TERM before -9) and verify the target service binds cleanly afterward.
Tracing a port 8080 conflict
ss -tulnp # see PID 889 (legacy-proxy) bound to :8080
tail -n 20 /var/log/checkout.err
kill 889 # send SIGTERM first
systemctl restart checkout-api
ss -tulnp # verify checkout-api now owns :8080Checking socket ownership first exposes why checkout-api fails to start instead of endlessly restarting the new service.
Practice ls -la, chmod, grep | wc, df -h, df -i, du, lsof, and ss -tulnp against five live troubleshooting missions.
Good practices and why
- Try graceful termination (SIGTERM / kill <pid>) before forceful SIGKILL (kill -9) so processes can flush state.
- Verify recovery by checking both port binding and actual endpoint behavior.
Common mistakes
- Running kill -9 as a first reflex on databases or stateful workers.
- Restarting a service repeatedly without reading its stderr/error log.
Try it yourself
Complete Mission 5 in the Linux CLI Lab to diagnose the port 8080 conflict, inspect /var/log/checkout.err, stop legacy-proxy, and start checkout-api.
What a successful result looks like
ss -tulnp confirms checkout-api is listening cleanly on port 8080.
0 / 6000 characters · Saved on this device. Do not include passwords or private data.
Check your understanding
Answer the understanding check correctly to record exercise completion.
Related interview practice
- All pods are healthy. Checkout is down. ↗
- The service works by IP but not by name. ↗
- Rolling deploys drop in-flight requests. ↗
These scenarios add constraints and follow-up questions to the concepts you just learned.
Further reading
Selected primary references · reviewed 2026-10-09. Examples are educational; use your framework’s documented integration guidance when building a deployed system.