services(5)
๐ services(5) โ the manual, but make it cute โจ
okay bestie, so this is services(5) from the File Formats Manual section, and ngl it's lowkey one of the most iconic little files on your whole system. let's get into it ๐ซถ
โจ NAME โจ
services โ the Internet network services list. that's it, that's the vibe. a whole list of services fr fr ๐๐
๐ธ DESCRIPTION ๐ธ
so services is a plain ASCII file that does the absolute most: it maps human-friendly textual names for internet services onto their underlying assigned port numbers and protocol types. like, it's the translator between "hey what's ftp" and "that's port 21, ma'am." ๐ฆ
every networking program should look into this file to get the port number (and protocol) for its service. and the C library routines getservent(3), getservbyname(3), getservbyport(3), setservent(3), and endservent(3) are the ones that support querying this file from programs. slay, setservent, you ate ๐
port numbers are assigned by the IANA (Internet Assigned Numbers Authority), and their current policy is to assign both TCP and UDP protocols when assigning a port number. so bestie, most entries will have two entries โ even for TCP-only services. it's giving "why is this duplicated" but no, it's intentional, periodt. ๐
port numbers below 1024 (the so-called "low numbered" ports) can be bound to only by root (peep bind(2), tcp(7), and udp(7)). why? because this way clients connecting to low numbered ports can trust that the service running on the port is the standard implementation, and not a rogue service run by a user of the machine. it's a whole trust thing, iykyk ๐ฅ well-known port numbers specified by the IANA are normally located in this root-only space.
โ ๏ธ okay this one matters: just because an entry for a service exists in the services file does not necessarily mean that the service is currently running on the machine. the file is a list, not a status report, bestie. ๐
see inetd.conf(5) for the configuration of Internet services offered. and note that not all networking services are started by inetd(8), and so won't appear in inetd.conf(5). in particular, news (NNTP) and mail (SMTP) servers are often initialized from the system boot scripts. so don't come for inetd when your mail server shows up out of nowhere ๐
the location of the services file is defined by _PATH_SERVICES in <netdb.h>. this is usually set to /etc/services. cute, classic, iconic ๐
๐ง each line, explained (the anatomy era) ๐
each line describes one service, and is of the form:
service-name port/protocol [aliases ...]
where:
service-nameโ is the friendly name the service is known by and looked up under. it is case sensitive. often, the client program is named after the service-name. main character energy fr ๐portโ is the port number (in decimal) to use for this service. just a number, love her for that. ๐ขprotocolโ is the type of protocol to be used. this field should match an entry in theprotocols(5)file. typical values includetcpandudp. ๐aliasesโ is an optional space or tab separated list of other names for this service. again, the names are case sensitive. don't get cute with the capitalization bestie, she's picky. โจ
either spaces or tabs may be used to separate the fields. flexible queen. ๐
comments are started by the hash sign (#) and continue until the end of the line. blank lines are skipped. so go ahead, write little notes to yourself, no one's judging ๐
the service-name should begin in the first column of the file, since leading spaces are not stripped. yes, literally the first column. no, the leading whitespace is not your friend here ๐ญ service-names can be any printable characters excluding space and tab. however, a conservative choice of characters should be used to minimize compatibility problems. for example, a-z, 0-9, and hyphen (-) would seem a sensible choice. stick to the basics, babe ๐
๐ lines not matching this format should not be present in the file. (currently, they are silently skipped bygetservent(3),getservbyname(3), andgetservbyport(3). however, this behavior should not be relied on.) so likeโฆ they'll ignore your chaos, but don't depend on them ignoring your chaos. that's the tea.
this file might be distributed over a network using a network-wide naming service like Yellow Pages/NIS or BIND/Hesiod. network-wide, bestie, it's everywhere ๐
๐ฆ a sample services file, for the girlies who need to see it ๐ธ
a sample services file might look like this:
netstat 15/tcp
qotd 17/tcp quote
msp 18/tcp # message send protocol
msp 18/udp # message send protocol
chargen 19/tcp ttytst source
chargen 19/udp ttytst source
ftp 21/tcp
# 22 - unassigned
telnet 23/tcp
look at that formatting. chef's kiss. see how msp has both tcp and udp? and chargen has two aliases? and # 22 is just sitting there, unassigned, minding her business ๐
also notice the columns line up and the names start at column one. iconic behavior only ๐
๐ FILES ๐
/etc/servicesโ The Internet network services list. the main character of this whole page, honestly ๐<netdb.h>โ Definition of_PATH_SERVICES. the header that tells you where the file lives ๐บ๏ธ
โญ SEE ALSO โญ
go read these next, bestie, they're all connected:
listen(2), endservent(3), getservbyname(3), getservbyport(3), getservent(3), setservent(3), inetd.conf(5), protocols(5), inetd(8)
Assigned Numbers RFC, most recently RFC 1700, (AKA STD0002). ๐
and that's the whole page, no cap. ๐ this was put out by the Linux man-pages 6.20 girlies, dated 2026-02-08, and it's the services(5) manual โ go forth and configure your ports responsibly, my love ๐ซถโจ๐
๐ฆ where this page comes from
- arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- ๐ the page's license: Linux-man-pages-copyleft
- Copyright 1996, Austin Donnelly <and1000@debian.org>
- Copyright 1995, Martin Schulze <joey@debian.org>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms