From time to time you may need to know what service is running on a particular port. The /etc/services
file contains that information and more.
Here we will take a look at some common services on a Linux system:
View your
/etc/services
file:more /etc/services
.Press the Space bar once to scroll the page down. See where it shows
"ftp"?
. The21
in the next column indicates the port that FTP is using. The/tcp
and/udp
means that port is available for both protocols.You should also see
telnet
(if not, press Enter a few times). It should show port23
.Now let's search for a service. Press the Backspace key a few times to go back to the top, and enter
/nameserver
.We can see that
nameserver
is using port42
and is available for both TCP and UDP.The file is quite long (over 11,000 lines on my system) as there are many, many standard ports.