Linux Server

How to Use Telnet Command in Linux Example

Telnet is a network protocol that allows remote communication with another device on a network. It is often used for testing and troubleshooting network services or connecting to a remote system. The telnet command in Linux is a valuable tool for administrators and developers to test connectivity and manage servers. 

In this blog, we will explore how to use Linux telnet commands, their functionality, and real-world use cases. 

What is Telnet? 

Telnet (TELecommunication NETwork) facilitates command-line communication between devices over a network. It provides an unencrypted text-based interface to connect to remote systems. Though replaced by more secure protocols like SSH, telnet Linux commands are still useful for specific tasks like debugging and testing. 

Read Also:- How to Find the IP Address of a Website in Linux

Installing Telnet on Linux 

Telnet might not be pre-installed on your Linux system. To install it, follow these steps:

For Debian/Ubuntu-based systems:

Telnet Command in Linux

For RHEL/CentOS-based systems:

Telnet Command in Linux

For Fedora systems:

For Fedora systems:

After installation, you can verify by typing:

Syntax of the Telnet Command

Telnet Command in Linux

The basic syntax of the telnet command in Linux is: 

  • hostname/IP address: The address of the target machine. 
  • port: The port number to connect to. If omitted, Telnet defaults to port 23. 

How to Use Telnet Command in Linux 

1. Check Network Connectivity

Telnet Command in Linux

You can use the linux telnet commands to test if a specific port on a remote system is accessible. For instance, to check if port 80 (HTTP) is open: 

If the connection is successful, you’ll see a blank screen. If it fails, it means the port is closed or inaccessible. 

2. Send HTTP Requests

Telnet Command in Linux

With Telnet, you can manually send HTTP requests to a web server: 

This will return the HTTP response from the server. 

3. Test Email Servers

Telnet Command in Linux

To check if an email server is accepting connections, connect to port 25 (SMTP): 

Read Also:- How to Change IP Address in Linux

You can then manually interact with the SMTP server to troubleshoot issues. 

4. Exit Telnet Sessions

Telnet Command in Linux

To close a Telnet session, press    Ctrl+]    to open the Telnet prompt and type: 

Common Use Cases of Telnet 

  1. Testing Network Services: Verify if services like HTTP, SMTP, or FTP are running on specific ports. 
  1. Debugging Firewalls: Check if firewalls are blocking certain ports. 
  1. Monitoring Devices: Communicate with network devices like routers and switches. 
  1. Educational Purposes: Learn how protocols work by manually sending commands. 

Limitations of Telnet 

  • No Encryption: Telnet sends data, including credentials, in plain text. 
  • Replaced by SSH: Secure Shell (SSH) offers encrypted and secure communication, making it a preferred alternative. 
  • Deprecated in Modern Environments: Due to security risks, many organizations no longer use Telnet. 

Alternatives to Telnet 

If security is a concern, consider using tools like: 

  • SSH: Provides encrypted remote access. 
  • Netcat (nc): A versatile tool for network testing. 
  • nmap: For network scanning and port testing. 

Check Also:-

protocols, it remains a useful tool for network testing, debugging, and learning. Whether you’re verifying open ports or troubleshooting email servers, the telnet command in Linux can provide quick and effective results. 

For tasks requiring enhanced security, consider alternatives like SSH. However, keeping Telnet in your toolkit ensures you’re prepared for legacy systems or specific debugging scenarios where its simplicity proves advantageous.

Contact Us

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button