s6-networking
Software
skarnet.org

The s6-getservbyname program

s6-getservbyname is a simple command-line interface to the getservbyname() function, converting a service name and protocol into a port number.

Interface

     s6-getservbyname name proto

Example

On a standard machine with a correct /etc/services file and a non-garbled NSS configuration: s6-getservbyname smtp tcp prints 25.