Home > Network Management > telnet

Complete Guide to the Telnet Command

`telnet` is a network protocol and command that allows you to connect to a remote host, open a terminal session, and execute commands. Due to security vulnerabilities, it is primarily used to check if specific ports on network devices are open. SSH (Secure Shell) is the modern secure protocol that replaces telnet.

Main Options

Telnet has a simple structure and does not have many options. It is mainly used to specify the target and port for connection.

1. Basic Connection

Generated command:

Try combining the commands.

Description:

`telnet` Executes the command.

Combine the above options to virtually execute commands with AI.

Installing Telnet

Most modern Linux distributions do not come with `telnet` installed by default due to security issues. You need to install it manually if you want to use it for tasks like checking ports. Using SSH is much safer for security.

Debian/Ubuntu

sudo apt update
sudo apt install telnet

How to install the telnet client on Debian or Ubuntu-based systems.

CentOS/RHEL/Fedora

sudo yum install telnet

How to install the telnet client on CentOS, RHEL, or Fedora-based systems.

Arch Linux

sudo pacman -S telnet

How to install the telnet client on Arch Linux.

Commonly Used Examples

Learn how to use `telnet` to check if a remote server's port is open. This is primarily useful for troubleshooting network issues.

Check Web Server Port (80)

telnet example.com 80

Checks if port 80 (HTTP) is open on a specific host.

Check SSH Port (22)

telnet example.com 22

Attempts to connect to port 22 (SSH) on a remote server.

Check FTP Port (21)

telnet ftp.example.com 21

Connects to port 21 on the FTP server to check for a response.

Check SMTP Server Port (25)

telnet mail.example.com 25

Connects to port 25 (SMTP) on the mail server to check for a response.

Connection Result

If the connection is successful, the cursor will blink with the message 'Connected to [host]'. If the connection fails, messages like 'Connection refused' or 'No route to host' will be displayed. To terminate the connection, press `Ctrl + ]` and then type `q`.


Related commands

These are commands that are functionally similar or are commonly used together.


Same category commands