s6-networking
Software
skarnet.org
s6-getservbyname is a simple command-line interface to the getservbyname() function, converting a service name and protocole into a port number.
s6-getservbyname name proto
On a standard machine with a correct /etc/services file and a non-garbled NSS configuration: s6-getservbyname smtp tcp prints 25.