GSEC · Question #241
You work as a Network Administrator for Net World Inc. The company has a Linux-based network. You are optimizing performance and security on your Web server. You want to know the ports that are…
The correct answer is A. netstat -a | grep FTP. To find ports listening for FTP on Linux, you pipe the full netstat output to grep to filter for FTP-related entries. The correct syntax combines netstat -a (all connections and listening ports) with grep FTP.
Question
You work as a Network Administrator for Net World Inc. The company has a Linux-based network. You are optimizing performance and security on your Web server. You want to know the ports that are listening to FTP. Which of the following commands will you use?
Options
- Anetstat -a | grep FTP
- BFTP netstat -r
- CFTP netstat -a
- Dnetstat -r | grep FTP
How the community answered
(57 responses)- A79% (45)
- B4% (2)
- C5% (3)
- D12% (7)
Why each option
To find ports listening for FTP on Linux, you pipe the full netstat output to grep to filter for FTP-related entries. The correct syntax combines netstat -a (all connections and listening ports) with grep FTP.
The 'netstat -a' flag displays all active connections and listening ports on the system, and piping its output to 'grep FTP' filters the results to show only lines referencing FTP - including port 21 which is the standard FTP control port. This two-command pipeline is the standard Linux method for identifying which ports are associated with a specific service.
This is invalid syntax - placing 'FTP' before 'netstat' is not a recognized command structure and would result in a command-not-found or parse error.
This is invalid syntax for the same reason as B - prefixing 'netstat' with 'FTP' does not form a valid Linux shell command.
The 'netstat -r' flag displays the kernel routing table, not listening ports or active connections, so it cannot be used to identify which ports are listening for FTP.
Concept tested: Using netstat and grep to filter listening ports
Source: https://man7.org/linux/man-pages/man8/netstat.8.html
Topics
Community Discussion
No community discussion yet for this question.