LX0-104 · Question #663
Which of the following files is consulted when programs like netstat try to match port numbers to names?
The correct answer is E. /etc/services. Programs like netstat consult the /etc/services file to map port numbers to their corresponding human-readable service names for display.
Question
Options
- A/etc/networks
- B/etc/portmapper
- C/etc/protocols
- D/etc/resolv.conf
- E/etc/services
How the community answered
(30 responses)- A3% (1)
- D7% (2)
- E90% (27)
Why each option
Programs like netstat consult the /etc/services file to map port numbers to their corresponding human-readable service names for display.
The /etc/networks file maps network names to network numbers, not port numbers to service names.
/etc/portmapper is not a standard configuration file for matching port numbers to names; portmapper (rpcbind) is a service that maps RPC program numbers to network port numbers.
The /etc/protocols file maps protocol names (like tcp, udp, icmp) to protocol numbers, not service names to port numbers.
The /etc/resolv.conf file specifies the configuration for DNS resolvers, such as nameserver addresses and search domains, not port-to-service name mappings.
The /etc/services file is a standard Unix-like system configuration file that contains a list of known service names and their corresponding port numbers and protocols (e.g., http 80/tcp), which netstat uses for displaying service names instead of numeric ports.
Concept tested: /etc/services file purpose
Source: https://www.man7.org/linux/man-pages/man5/services.5.html
Topics
Community Discussion
No community discussion yet for this question.