The article helps you to understand /etc/services file in Linux. Learn about content, format & importance of this file.
Internet daemon is an important service in the Linux world. It takes care of all network services with the help of
/etc/services file. In this article, we will walk you through the content, format of this file, and what it means to a Linux system.
/etc/services file contains a list of network services and ports mapped to them.
xinetd looks at these details so that it can call a particular program when a packet hits respective port and demand for service.
As a normal user, you can view this file since the file is world-readable. To edit this file you need to have root privileges.
$ ll /etc/services -rw-r--r--. 1 root root 670293 Jun 7 2013 /etc/services
/etc/services file format
service-name port/protocol [aliases..] [#comment]
Last two fields are optional hence denoted in
] where –
- service-name is the name of the network service. e.g. telnet, FTP, etc.
- port/protocol is the port being used by that network service (numerical value) and protocol (TCP/UDP) used for communication by service.
- alias is an alternate name for service.
- a comment is a note or description you can add to service. Starts with
# Each line describes one service, and is of the form: # # service-name port/protocol [aliases ...] [# comment] tcpmux 1/tcp # TCP port service multiplexer rje 5/tcp # Remote Job Entry echo 7/udp discard 9/udp sink null
Here, you can see the use of optional last two fields as well.
discard service has an alternate name as