exam questions

Exam CAS-004 All Questions

View all questions & answers for the CAS-004 exam

Exam CAS-004 topic 1 question 18 discussion

Actual exam question from CompTIA's CAS-004
Question #: 18
Topic #: 1
[All CAS-004 Questions]

A security analyst is reviewing network connectivity on a Linux workstation and examining the active TCP connections using the command line.
Which of the following commands would be the BEST to run to view only active Internet connections?

  • A. sudo netstat -antu | grep ג€LISTENג€ | awk '{print$5}'
  • B. sudo netstat -nlt -p | grep ג€ESTABLISHEDג€
  • C. sudo netstat -plntu | grep -v ג€Foreign Addressג€
  • D. sudo netstat -pnut -w | column -t -s $'\w'
  • E. sudo netstat -pnut | grep -P ^tcp
Show Suggested Answer Hide Answer
Suggested Answer: E 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
fb2fcb1
Highly Voted 7 months, 1 week ago
Selected Answer: E
E. sudo netstat -pnut | grep -P ^tcp The command "sudo netstat -pnut | grep -P ^tcp" would be the best option to view only active Internet connections on a Linux workstation. Explanation of the command: "sudo" is used to run the command with administrative privileges. "netstat" is the command-line utility for displaying network connections. "-pnut" displays active network connections (-t for TCP connections, -u for UDP connections, and -n for numerical addresses instead of resolving hostnames). The "-p" option shows the process ID and name associated with each connection. "grep -P ^tcp" filters the output to show only TCP connections. This command will provide a list of active TCP connections, including the process ID and name associated with each connection.
upvoted 6 times
...
blacksheep6r
Most Recent 2 months, 3 weeks ago
Selected Answer: E
Correct Answer: ✔ E) sudo netstat -pnut | grep -P ^tcp Explanation: This command is best suited for viewing active Internet connections (TCP and UDP) because: netstat -pnut → Shows protocols (-p), numeric addresses (-n), UDP (-u), and TCP (-t) connections. grep -P ^tcp → Uses Perl-compatible regex (-P) to filter only active TCP connections (since most Internet-based connections use TCP). It provides a clear view of Internet-based TCP connections on the Linux workstation.
upvoted 1 times
...
AceAk47
5 months ago
Selected Answer: B
According to ChatGBT, the answer is B. sudo netstat -nlt -p | grep ג€ESTABLISHEDג€
upvoted 1 times
...
BiteSize
7 months, 1 week ago
Selected Answer: E
Source: Verifying each answer against Chat GPT, my experience, other test banks, a written book, and weighing in the discussion from all users to create a 100% accurate guide for myself before I take the exam. (It isn't easy because of the time needed, but it is doing my diligence)
upvoted 2 times
...
jhxetc
7 months, 1 week ago
Selected Answer: E
This is a very weird question. The question mentions that the analyst is looking for TCP connections, but then asks the BEST way to view "Active Internet Connections." Anyone who's ever run netstat, will know that it ALWAYS says "Active Internet Connections." So literally any of these commands could be interpreted as correct. If we are only truly interested in ESTABLISHED TCP connections - which can be interpreted as an "active" connection, B is the obvious answer. If we are interested in only outgoing connections for both protocols, then D is the best choice - however I am inclined to think that we only care about TCP. E seems silly since the better idea would be to just omit -u and not to the grep, however it does achieve only showing tcp connections, however it will include TIME_WAIT and CLOSED connections - which aren't considered "active" in some senses, however because of their word choice being the same word choice that netstat ALWAYS outputs, I would have to go with E.
upvoted 2 times
...
23169fd
9 months, 3 weeks ago
Selected Answer: E
E is correct.
upvoted 1 times
23169fd
9 months, 3 weeks ago
e command sudo netstat -nlt -p | grep "ESTABLISHED" has a mistake due to the combination of options -l (for listening) and filtering for "ESTABLISHED" state. The -l option restricts the output to only listening sockets, which will never be in the "ESTABLISHED" state. Therefore, the command won't produce any meaningful results for active connections.
upvoted 1 times
...
...
Delab202
1 year, 3 months ago
Selected Answer: E
To view only active Internet connections on a Linux workstation, the BEST command to run would be: E. sudo netstat -pnut | grep -P ^tcp
upvoted 1 times
...
secdoc
1 year, 6 months ago
Has to be D, internet connections are absolutely both UDP and TCP based so we need to see both.
upvoted 1 times
...
margomi86
2 years, 1 month ago
Selected Answer: E
E. sudo netstat -pnut | grep -P ^tcp This command displays active TCP connections and filters only those that are established (not listening or waiting) with the "grep" command. The "-p" option shows the process ID and name associated with each connection, and the "-n" option displays numerical addresses and ports instead of resolving them to names. The "^tcp" pattern filters only TCP connections, and the "-u" and "-t" options show only UDP and TCP connections, respectively. This command is the best option to view only active Internet connections on a Linux workstation.
upvoted 1 times
...
OneSaint
2 years, 2 months ago
Selected Answer: D
Answer is D, the command displays "Active Internet sonnections" netstat -pnut -w | column -t -s $’\w’
upvoted 1 times
...
FOURDUE
2 years, 3 months ago
Selected Answer: E
I tried both D & E commands. D's output yielded a UDP connection. E did not labadmin@labadmin-virtual-machine:~$ sudo netstat -pnut | grep -P ^tcp Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name udp 0 0 192.168.88.128:68 192.168.88.254:67 ESTABLISHED 705/Net orkManager labadmin@labadmin-virtual-machine:~$ E is the clear winner
upvoted 2 times
FOURDUE
2 years, 3 months ago
We are only concerned with examining the active TCP connections using the command line.
upvoted 1 times
...
...
PacKitty
2 years, 4 months ago
Yes agreed with RevZig67 ' Option D' gives the best result, as the question clearly states "Active Internet Connection" no other commands state that in the output
upvoted 1 times
...
lordguck
2 years, 5 months ago
E: as the netstat "u" parameter gives UDP connections, also and the grep "tcp" filters those out.
upvoted 3 times
definitely
1 year, 8 months ago
thanks this was a good simple explanation
upvoted 1 times
...
...
adamwella
2 years, 7 months ago
Selected Answer: E
Don't let B. trick you
upvoted 3 times
...
adamwella
2 years, 7 months ago
The selected answer should be E.
upvoted 3 times
...
ukuwai
2 years, 8 months ago
Choice b will trick you and is not realistic since no one will use this command for this purpose. The answer is E.
upvoted 2 times
...
RevZig67
2 years, 11 months ago
Selected Answer: E
I tried each command in an UBUNTU shell. Answer D gave the best results. Try it.
upvoted 3 times
emaney
2 years, 10 months ago
is the answer E or D?
upvoted 3 times
Matty_B
2 years, 3 months ago
Any update to which one is correct?
upvoted 1 times
...
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago