Which command lists listening ports and owning processes?

Prepare for the Google Data Center Technician Exam. Use our interactive quiz featuring flashcards and multiple choice questions with hints and explanations. Get exam-ready today!

Multiple Choice

Which command lists listening ports and owning processes?

Explanation:
Identifying which sockets are listening and which process owns each one is essential for diagnosing open services and port usage. The best way to see this in one clear view is to use a modern, focused tool that queries the kernel’s socket table and reports both the port and the owning process. Using the command ss with those flags provides exactly that: it lists TCP and UDP sockets, shows only those that are listening, includes the owning process (PID and name), and prints numeric ports to avoid name lookups. The combination -t (TCP) -u (UDP) -l (listening) -p (process) -n (numeric) gives a concise, actionable snapshot of all listening ports and who’s using them. In practice, you can run it with elevated privileges to reveal the process names more reliably, typically via sudo. While netstat can supply a similar view, it’s older and increasingly replaced by ss in modern systems. The other option listed, lsof -i, can show network files and associated processes but isn’t as direct for isolating just listening sockets, and it often requires extra filtering. The remaining option, tracepath, is unrelated to listing sockets or processes. So, ss -tulpn is the most straightforward, up-to-date way to list listening ports along with their owning processes.

Identifying which sockets are listening and which process owns each one is essential for diagnosing open services and port usage. The best way to see this in one clear view is to use a modern, focused tool that queries the kernel’s socket table and reports both the port and the owning process.

Using the command ss with those flags provides exactly that: it lists TCP and UDP sockets, shows only those that are listening, includes the owning process (PID and name), and prints numeric ports to avoid name lookups. The combination -t (TCP) -u (UDP) -l (listening) -p (process) -n (numeric) gives a concise, actionable snapshot of all listening ports and who’s using them. In practice, you can run it with elevated privileges to reveal the process names more reliably, typically via sudo.

While netstat can supply a similar view, it’s older and increasingly replaced by ss in modern systems. The other option listed, lsof -i, can show network files and associated processes but isn’t as direct for isolating just listening sockets, and it often requires extra filtering. The remaining option, tracepath, is unrelated to listing sockets or processes.

So, ss -tulpn is the most straightforward, up-to-date way to list listening ports along with their owning processes.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy