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:
For RHEL/CentOS-based systems:
For Fedora systems:
After installation, you can verify by typing:
Syntax of the Telnet Command
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
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
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
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
To close a Telnet session, press Ctrl+] to open the Telnet prompt and type:
Common Use Cases of Telnet
- Testing Network Services: Verify if services like HTTP, SMTP, or FTP are running on specific ports.
- Debugging Firewalls: Check if firewalls are blocking certain ports.
- Monitoring Devices: Communicate with network devices like routers and switches.
- 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:-
- Windows VPS Hosting
- Windows VPS Server
- Windows VPS Hosting India
- Windows VPS Server India
- Cheap Windows VPS India
- Windows VPS in India
- Windows Virtual Private Server
- Best Windows VPS Hosting
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