Services
Services File
Typically found at /etc/services.
The services file contains information regarding the known services available in the DARPA Internet. For each service a single line should be present with the following information:
official service nameport numberprotocol namealiases
Items are separated by any number of blanks and/or tab characters. The port number and protocol name are considered
a single item; a / is used to separate the port and protocol (e.g. 512/tcp). A # indicates the
beginning of a comment; subsequent characters up to the end of the line are not interpreted by the routines which search
the file.
Service names may contain any printable character other than a field delimiter, newline, or comment character.
serviceToPort
Get the port number associated with a service
Usage
serviceToPort service [ --services servicesFile ] [ --help ]
Get the port number associated with a service
Arguments
service- String. Required. A unix service typically found in/etc/services--services servicesFile- File. Optional. File like '/etc/services`.--help- Flag. Optional. Display this help.
Sample Output
Port number of associated service (integer) one per line
Return codes
1- service not found2- bad argument or invalid port0- service found and output is an integer
serviceToStandardPort
Hard-coded services for:
Usage
serviceToStandardPort [ --help ] [ service ... ]
Hard-coded services for:
- ssh -> 22
- http-> 80
- https-> 80
- postgres-> 5432
- mariadb-> 3306
- mysql-> 3306
Backup when /etc/services does not exist.
Arguments
--help- Flag. Optional. Display this help.service ...- String. Optional. A unix service typically found in/etc/services
Sample Output
Port number of associated service (integer) one per line
Return codes
1- service not found0- service found and output is an integer