Skip to content

July 23, 2017

Check if a Service is Running Using Telnet and How to Quit Telnet Session

by linux

Telnet is not used that much anymore. To connect to a managed switch CLI this could be your only options. But then telnet has other use: you can check if a service run on a port on a remote machine.

For example to check if mysql server is running on a remote machine:

 # telnet 10.0.0.20 3306
Trying 10.0.0.20...
Connected to 10.0.0.20.
Escape character is '^]'.
J
5.6.36�-;#:<]A�w7HDZ{|{tV24mysql_native_password

To check if ssh is running on a remote machine:

 # telnet 10.0.0.20 22
Trying 10.0.0.20...
Connected to 10.0.0.20.
Escape character is '^]'.
SSH-2.0-OpenSSH_7.2
 
Protocol mismatch.
Connection closed by foreign host.

You should get some reply from the remote machine with a text.

If you get no reply that means either that the service is not running or the service is running on other port (in case of SSH) or that the remote machine’s firewall blocks the access from outside to that service.

Now, if you want to quit telnet you will notice Ctrl + C is not working.

In order to quit telnet press Ctrl + ] to get to telnet console then type: quit

Read more from Linux Quick Tips

Leave a Reply

required
required

Note: HTML is allowed. Your email address will never be published.

Subscribe to comments