Network Troubleshooting
A Linux server may be running an unauthorized service. Which command lists the local listening TCP ports along with the process using each?
Show the answer
Correct answerA. netstat -tlnp
AWhy this is right: The -t, -l, -n and -p flags show listening TCP sockets, numeric ports and the owning process.
BWhy not this: nmap localhost scans for open ports but cannot show which process owns each one.
CWhy not this: The -r flag prints the routing table, which says nothing about listening ports.
DWhy not this: The -s flag prints per-protocol statistics, not individual listening sockets or processes.
netstat -tlnp shows listening TCP sockets in numeric form with the owning process ID and name. nmap localhost can list open ports but does not identify the process that owns them.