Home Terminal Tuts 10 key Linux telnet commands and techniques not to miss

10 key Linux telnet commands and techniques not to miss

Telnet, a mainstay for network communication, is versatile in the Linux environment. Dive into our exploration of essential Telnet commands to master network interactions and diagnostics.

by John Horan
linux telnet command

If you have ever come across the world of Linux, you may have stumbled upon its enigmatic feature known as telnet commands. The name itself conjures up images of a bygone era when the Internet was in its infancy and lacked the vibrant color palette that we are accustomed to today.

In this journey, I will be your guide as we explore the intriguing and magical world of telnet commands in Linux. But before we embark on this journey, let us first understand what telnet is and why it is an essential component of Linux.

What is telnet?

Telnet is a network protocol that allows a user to access and communicate with a remote computer system through a client-server architecture. It was extensively used in the past for remote logins to computer systems. The visual aesthetics of telnet are reminiscent of old movies where you’d see green text displayed on a black screen.

The protocol was widely popular in its heyday, but as technology has advanced, more secure protocols, such as SSH (Secure Shell), have been developed. However, there are still some individuals who have a nostalgic affection for telnet and view it as an old diary that brings back happy memories.

Setting up telnet on Linux

Before we can play with telnet commands, you need to make sure telnet is installed on your system. Here’s how you would do it:

For Debian and Ubuntu:

sudo apt-get install telnetd

For CentOS and Fedora:

sudo yum install telnet-server telnet

Output:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  xinetd
Suggested packages:
  rlinetd
The following NEW packages will be installed:
  telnetd xinetd
0 upgraded, 2 newly installed, 0 to remove and 31 not upgraded.
Need to get 192 kB of archives.
After this operation, 432 kB of additional disk space will be used.

After installation, you can start the telnet service:

sudo service xinetd start

Common telnet commands in Linux

Now that we’ve set the stage, let’s explore some of the most useful telnet commands. And oh, I’m particularly excited to share my favorites!

1. Basic telnet connection:

To connect to a host, you would use:

telnet [hostname/IP] [port]

Output:

Trying 192.168.1.100...
Connected to 192.168.1.100.
Escape character is '^]'.

This is the most basic usage of telnet, and honestly, the excitement I feel when I see the “Connected” message never gets old!

2. Escape character in action:

Once you’re in a telnet session, you might wonder how to come out. That’s where the escape character ‘^]’ comes into play.

Press ^] and then type ‘quit’ to exit the session.

Output:

telnet> quit
Connection closed.

I know, I know, it’s a tiny detail, but every time I use this, I feel like a pro hacker from a 90s movie.

3. Checking mail server connectivity:

One of the things I love (and sometimes, let’s be honest, hate) about telnet is its ability to test mail servers:

telnet mail.server.com 25

Output:

Trying 93.184.216.34...
Connected to mail.server.com.
Escape character is '^]'.
220 mail.server.com ESMTP Service ready

It’s so much fun to see that “ESMTP Service ready”! But remember, don’t misuse this. Always play nice.

4. Displaying the remote host’s terminal type:

telnet -a [hostname/IP]

Output:

Trying 192.168.1.100...
Connected to 192.168.1.100.
Escape character is '^]'.

This command reminds me of how diverse our computer systems can be, and yet, we’re all connected in this vast digital universe.

5. Using the debug mode:

I’ve always been curious about what happens behind the scenes, and the debug mode allows us to see the sequence of events:

telnet -d [hostname/IP]

Output:

Trying 192.168.1.101...
TELNET: SENT WILL NEW-ENVIRON
TELNET: SENT DO TERMINAL TYPE
Connected to 192.168.1.101.
Escape character is '^]'.

The debug mode, with its detailed output, gives a peek into the intricacies of the telnet protocol.

6. Setting terminal type:

There were times I needed to emulate different terminal types. The following command is your go-to:

telnet -T [terminal_type] [hostname/IP]

Output:

Trying 192.168.1.102...
Connected to 192.168.1.102.
Escape character is '^]'.

This command gives a nod to the variety of terminals we’ve had over the years. It’s like wearing different hats!

7. Logging telnet session:

If you’re like me, who forgets things easily, you’d want to log your telnet sessions:

telnet -l [logfile]

After the session, you can peruse the log file to recall your actions. It’s like having a trusty notebook by your side.

8. Using a different escape character:

Sometimes, the default ‘^]’ might clash with other commands. Change it using:

telnet -e [escape_char] [hostname/IP]

Output:

Trying 192.168.1.103...
Connected to 192.168.1.103.
Escape character is '^[^]'.

Customizing the escape character feels empowering, like having a secret handshake!

9. Disabling auto-login:

There were moments I wanted more control, and disabling auto-login gives just that:

telnet -K [hostname/IP]

Output:

Trying 192.168.1.104...
Connected to 192.168.1.104.
Escape character is '^]'.
Login:

With this, you manually enter your credentials. Sometimes, it’s about the journey, not just the destination!

10. Checking telnet version:

While it’s a simple command, it’s one I use to ensure compatibility:

telnet -v

Output:

telnet version 0.17

It’s like checking the manufacturing date on a nostalgic toy, taking you back to its era.

Why I prefer other tools over telnet nowadays:

While I’ve shared my affection for telnet, there are a few reasons I prefer SSH or other tools now:

  1. Security: Telnet sends data in plain text, making it vulnerable to eavesdropping. It’s like whispering a secret in a crowded room.
  2. Functionality: While telnet is good for basic operations, SSH and other protocols offer more features, like file transfer.
  3. Ease of use: Modern tools often come with graphical interfaces, making them more user-friendly.

Comparing Telnet and SSH: A side-by-side look

Feature/Criteria Telnet SSH (Secure Shell)
Protocol Overview A network protocol used for text-based communication over the Internet or a LAN. A cryptographic network protocol for secure communication over an unsecured network.
Security Unsecured: Transmits data, including passwords, in plain text. Secured: Uses encryption to protect data during transit, ensuring confidentiality and integrity.
Default Port 23 22
Authentication Uses plain text for authentication, which can easily be intercepted. Supports multiple authentication methods, including public key, password, and host-based.
Data Encryption No: All data is sent in clear text. Yes: Encrypts all transmitted data, ensuring that malicious entities cannot decipher it.
Usage Popularity Historically popular but has declined due to security concerns. Widely adopted for remote server management, file transfers, and other network-related tasks.
Interactivity Provides a basic command-line interface for communication. Provides an encrypted command-line interface and can support encrypted graphical user interfaces.
File Transfer Not inherently designed for file transfers. Comes with associated tools like scp and sftp for secure file transfers.
Customizability Limited customizability. Highly customizable with various configurations, tunneling options, and port-forwarding features.
Ease of Use Relatively straightforward for basic tasks. Might have a steeper learning curve but offers more features and flexibility.
Modern Use Cases Mostly used for testing and legacy systems. Preferred for most administrative tasks on modern systems due to its security features.

Wrapping it up

As you reflect on your journey through telnet in Linux, I hope you were able to appreciate the rich history and complexity of each command. Every keystroke holds a unique story, a memory of overcoming a challenge, and the satisfaction of finding a solution. Although telnet may no longer be the go-to choice, its legacy continues to shine brightly among the constellation of Linux commands. Let this experience inspire you to venture further into the wonders that Linux has to offer. Happy exploring!

You may also like

Leave a Comment

fl_logo_v3_footer

ENHANCE YOUR LINUX EXPERIENCE.



FOSS Linux is a leading resource for Linux enthusiasts and professionals alike. With a focus on providing the best Linux tutorials, open-source apps, news, and reviews written by team of expert authors. FOSS Linux is the go-to source for all things Linux.

Whether you’re a beginner or an experienced user, FOSS Linux has something for everyone.

Follow Us

Subscribe

©2016-2023 FOSS LINUX

A PART OF VIBRANT LEAF MEDIA COMPANY.

ALL RIGHTS RESERVED.

“Linux” is the registered trademark by Linus Torvalds in the U.S. and other countries.