Using the iproute2 socket utility, list only listening TCP sockets, with ports and addresses left as numbers rather than resolved to service and host names. Type the complete command, using short options only.
LPIC-1 Exam 102-500, objective 110. Security medium
Draft — not checked yet. This question was written from the published exam objectives and cites the clause it comes from, but nobody has yet read it against that clause and signed for it.
It is kept out of search results and out of mock exams until they have. Read the source below before you take the answer as settled.
Answer
Type the answer.
Accepted answers
ss -tlnss -tnlss -ltnss -lntss -ntlss -nltss -t -l -nss -t -n -lss -l -t -nss -l -n -tss -n -t -lss -n -l -t
Case sensitive — Linux is, and grading LS as ls would teach a falsehood.
Why
ss -tln is the modern replacement for netstat -tln. -t restricts output to TCP, -l shows only sockets in the listening state, and -n suppresses name resolution so you see 22 rather than ssh and 0.0.0.0 rather than a hostname. Add -u to include UDP and -p to show the owning process, which requires root to be useful. The equivalent netstat invocation is `netstat -tlnp`, but netstat comes from the deprecated net-tools package and is not installed by default on many current distributions.
Where this comes from
- Cited
- LPI exam objective 110.1
- What it says
- Discover open network ports and the services listening on them.
Practise this
Reading one question is not practice. The trainer will draw a set from objective 110 and space the ones you get wrong.