Remix.run Logo
kazinator 2 hours ago

The file /etc/services maps names to port numbers, like /etc/hosts does for hosts.

E.g. "telnet localhost ssh" takes you to port 22 (not the default 23 for telnet). This works because /etc/services maps "ssh" to "22".

If you're sick of remembering port numbers, create some entries in your /etc/services.

Of course, only programs which use getservbyname to resolve port numbers will accept your names.

saidnooneever 44 minutes ago | parent [-]

maintaining services files.

i dont know why people keep insiting on that file while there are perfectly fine commands to pull from your boxes what is holding what port.

that is all besides the point though if you look at what you should be doing and keeping all this information in some kind of asset management system from which you can deploy things (which is kinda what k8s and docker etc. try to do (miserably)).

unless you are binding stuff to random ports on random boxes there is no need to do any of it at runtime and you can just consult your bookkeeping (for which etc services lacks a lot of details to use...)