Which command shows all TCP sockets and the programs that are using them, including listening services?

Study for the OSCP Linux Exam. Use our flashcards and multiple-choice questions to test your skills. Each query comes with detailed hints and explanations to enhance your preparedness. Get ready to conquer the exam!

Multiple Choice

Which command shows all TCP sockets and the programs that are using them, including listening services?

Explanation:
To see TCP sockets and the programs using them, you need a command that lists sockets and also shows which process owns each one. The flags we want are: -a to include all sockets (including those in the listening state), -t to restrict the view to TCP sockets, and -p to display the owning program (PID and name) for each socket. Put together, this combination yields every TCP endpoint along with the exact process that’s using it, including listening services. Other options don’t fit as cleanly. One choice would include UDP sockets as well, which isn’t what the question asks for. Another option uses a different tool that can show similar information, but it isn’t the same command with the exact flags needed to filter strictly to TCP and show the program names in one go. A third option would also work in practice but relies on a different tool and flags, not the netstat combination specified.

To see TCP sockets and the programs using them, you need a command that lists sockets and also shows which process owns each one. The flags we want are: -a to include all sockets (including those in the listening state), -t to restrict the view to TCP sockets, and -p to display the owning program (PID and name) for each socket. Put together, this combination yields every TCP endpoint along with the exact process that’s using it, including listening services.

Other options don’t fit as cleanly. One choice would include UDP sockets as well, which isn’t what the question asks for. Another option uses a different tool that can show similar information, but it isn’t the same command with the exact flags needed to filter strictly to TCP and show the program names in one go. A third option would also work in practice but relies on a different tool and flags, not the netstat combination specified.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy