How do you list all open ports and associated services - CompTIA Linux + XK0-005

Question

How do you list all open ports and associated services?

Answers
  1. correct
Explanation

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.

Related Courses

Discover a range of courses designed to provide you with the knowledge and skills needed to excel in your chosen field.

a prepsaret exam featured image
CompTIA Prep

220-1201 - CompTIA A+ Exam Core 1

Start Course Prep
a prepsaret exam featured image
CompTIA Prep

220-1202 - CompTIA A+ Exam Core 2

Start Course Prep
a prepsaret exam featured image
CompTIA Prep

CompTIA SecurityX CAS-005

Start Course Prep
a prepsaret exam featured image
CompTIA Prep

CompTIA Cloud Essentials+ CLO-002

Start Course Prep
a prepsaret exam featured image
CompTIA Prep

CompTIA Network+ N10-009

Start Course Prep
a prepsaret exam featured image
CompTIA Prep

CompTIA Security+ SY0-701

Start Course Prep
a prepsaret exam featured image
CompTIA Prep

CompTIA Data + DA0-001

Start Course Prep
a prepsaret exam featured image
CompTIA Prep

CompTIA Pentest+

Start Course Prep
a prepsaret exam featured image
CompTIA Prep

CompTIA CySA+ CSO-003

Start Course Prep
a prepsaret exam featured image
CompTIA Prep

CompTIA DataSys+ DS0-001

Start Course Prep
a prepsaret exam featured image
CompTIA Prep

CompTIA Tech+ FC0-U71

Start Course Prep
a prepsaret exam featured image
CompTIA Prep

CompTIA Cloud+ CV0-004

Start Course Prep
a prepsaret exam featured image
CompTIA Prep

CompTIA Server+ SK0-005

Start Course Prep

Easy way to pass your test within a week with prepsaret

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

View Courses Offered