LPIC-2 System Security Practice Question
Which TWO commands can be used to list all currently listening TCP ports and the associated processes?
⚠ Common exam trap
Test-takers frequently think lsof or nmap are valid for listing all listening ports with processes, but lsof requires specific syntax and does not natively filter by listening state without extra flags, while nmap is an active scanner, not a passive listener display tool.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
ss -tlnp
(ss -tlnp) is correct because the ss command with -t (TCP), -l (listening), -n (numeric), and -p (process) shows all listening TCP ports and their associated processes. Option C (netstat -tlnp) is correct because netstat with the same flags provides equivalent output, though ss is the modern replacement on many distributions.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
lsof -i TCP -s TCP:LISTEN
Why it's wrong here
This also works but is not as standard as ss/netstat on minimal systems; however, the question asks for TWO, and ss/netstat are the most common.
- ✓
ss -tlnp
Why this is correct
ss -tlnp shows listening TCP ports with process info.
- ✓
netstat -tlnp
Why this is correct
netstat -tlnp also shows listening TCP ports with process info.
- ✗
fuser -v 80/tcp
Why it's wrong here
fuser shows processes using a specific port, not all ports.
- ✗
nmap -sT localhost
Why it's wrong here
nmap scans ports but does not show local process info.
Go deeper
Related to this question
About these practice questions
This LPIC-2 question is part of Courseiva's 507-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This LPIC-2 practice question is part of Courseiva's free LPI certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the LPIC-2 exam.