How do you list all open ports and associated services?
The Correct Answer is: B. lsof -i
The lsof -i command lists all open internet sockets on a system, showing which ports are open and the services or processes using them. This is useful for network troubleshooting and security auditing, as it helps identify active connections and listening ports.
Why the other options are incorrect:
A. ps -ef
This command displays a list of currently running processes, including details like process ID, user, and command. However, it does not show any information about open ports or network connections, so it’s not helpful for checking network activity.
C. openports
There is no standard Linux command called openports. Some third-party tools may have similar names, but they are not included by default in Linux distributions. It’s not a recognized or reliable way to list open ports or services.
D. ip -a
This is likely a mistaken form of ip a, which shows network interface information, such as IP addresses and MAC addresses. It does not display open ports or the processes using them, so it cannot be used for this purpose.
Discover a range of courses designed to provide you with the knowledge and skills needed to excel in your chosen field.
You don’t need one month to study and pass your test.
With Prepsaret, it takes you a few days to grasp all the concepts needed to pass your exams