Telnet is a command protocol that allows a user to connect to a remote host. It makes use of TCP/IP protocol to establish connection with the remote computer.
This command is a valuable tool which allows in troubleshooting and testing of various services in a server. One of the main uses of the telnet command is to check if a particular port is listening on a server. The general format of the telnet command is as below:
telnet [hostname/ipaddress] [port number]
The below example command tests if port 22 is listening for the IP address 123.123.123.123.
telnet 123.123.123.123 22
By default, telnet client is not installed in any Linux/Windows distributions. This guide outlines the general steps to install telnet command in both Linux and Windows servers.
CentOS 6/7/8 & Fedora
Telnet command can be installed using YUM in all CentOS and Fedora distributions.
Execute the below command to install telnet.
# yum -y install telnet
Verify that the command is installed successfully.
# telnet localhost 22
Ubuntu & Debian
Telnet command can be installed both in Ubuntu and Debian systems using the APT command.
Execute the below command to install telnet.
# apt-get install telnet
Verify that the command is installed successfully.
# telnet localhost 22
Windows OS
If telnet command is not installed in a Windows server, an output similar to below will be received when trying to use telnet.
In this situation, telnet command can be installed either through the command prompt or the Server Manager graphical interface.
Installing telnet client through command prompt
To install telnet client, run the below command in the command prompt with administrator permissions.
> dism /online /Enable-Feature /FeatureName:TelnetClient
Type
telnet
and pressEnter
in command prompt, to verify that the command is installed successfully.
Installing telnet client through graphical interface
Server Manager
feature can be used to install telnet through graphical interface. For this, follow the below steps.
Open
Server Manager
.Click
Add roles and features
.Click
Next
in theBefore you begin
screen.In the
Installation Type
screen, make sure thatRole-based or feature-based installation
option is selected and clickNext
.In the
Server Selection
screen, select the server in which telnet is to be installed on. By default, the local server should be selected, clickNext
.Click
Next
in theServer Roles
screen without selecting anything, since a Windows feature is being installed rather than a role.In the
Features
screen, scroll down the list and select the check box next toTelnet Client
and then clickNext
.On the
Confirmation
screen, clickInstall
.Once installation has been completed, a similar screen as below will be displayed. Click
Close
to exit the wizard.Type
telnet
and pressEnter
in command prompt, to verify that the command is installed successfully.
Related Tutorials
How to Enable & Disable Ping (ICMP Echo Requests) in Windows Server 2019 Firewall
How to Enable & Disable Ping (ICMP Echo Requests) from IPTables on Linux Cloud Servers
How to check if TCP / UDP port is open on Linux & Windows Cloud Servers
How to Enable & Disable Remote Desktop Protocol (RDP) on Windows Cloud Servers