Which command maps a port to the owning process?

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 maps a port to the owning process?

Explanation:
To map a port to the owning process, you need a command that lists sockets along with the process that owns them. The best approach is to use a tool designed to show port/socket information with the owning process included. The command ss -tulpn lists TCP and UDP sockets (-t and -u), shows only listening sockets (-l), includes the owning process name and PID (-p), and displays numeric addresses and ports (-n). Piping this output to grep with the specific port filters the results to the line for that port, revealing which process is using it. This approach is preferred because ss is the modern replacement for netstat and provides reliable, fast access to process associations for sockets. While netstat can do something similar, it’s less commonly recommended nowadays, and ps alone won’t map ports to processes. Lsof could also show the mapping, but the given option uses ss for a direct, efficient match.

To map a port to the owning process, you need a command that lists sockets along with the process that owns them. The best approach is to use a tool designed to show port/socket information with the owning process included. The command ss -tulpn lists TCP and UDP sockets (-t and -u), shows only listening sockets (-l), includes the owning process name and PID (-p), and displays numeric addresses and ports (-n). Piping this output to grep with the specific port filters the results to the line for that port, revealing which process is using it.

This approach is preferred because ss is the modern replacement for netstat and provides reliable, fast access to process associations for sockets. While netstat can do something similar, it’s less commonly recommended nowadays, and ps alone won’t map ports to processes. Lsof could also show the mapping, but the given option uses ss for a direct, efficient match.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy