Which Linux command shows listening ports and current TCP connections?

Prepare for the eLearnSecurity Junior Penetration Tester exam with our comprehensive quiz platform. Improve your skills with multiple-choice questions, detailed explanations, and exam tips. Get exam ready with ease!

Multiple Choice

Which Linux command shows listening ports and current TCP connections?

Explanation:
You want a snapshot that shows both what ports are open for connections and which TCP sessions are currently active, including which process owns each socket. netstat with -t (TCP) and -u (UDP) shows the sockets in use, -n presents numeric addresses and ports for clarity, and -p reveals the owning process. This combination lists both listening ports and established TCP connections in one view, giving you a complete picture of what’s exposed and what’s actually connected, along with who owns each connection. It’s a concise, widely available Linux command for this purpose. Other tools can show similar data but may be slower, more verbose, or skew toward a different aspect of networking, whereas this invocation cleanly covers listening and active TCP connections in one shot.

You want a snapshot that shows both what ports are open for connections and which TCP sessions are currently active, including which process owns each socket. netstat with -t (TCP) and -u (UDP) shows the sockets in use, -n presents numeric addresses and ports for clarity, and -p reveals the owning process. This combination lists both listening ports and established TCP connections in one view, giving you a complete picture of what’s exposed and what’s actually connected, along with who owns each connection. It’s a concise, widely available Linux command for this purpose. Other tools can show similar data but may be slower, more verbose, or skew toward a different aspect of networking, whereas this invocation cleanly covers listening and active TCP connections in one shot.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy