The telnet utility, a once common protocol that graced the terminal of every system administrator and power user, was a precursor for the SSH protocol. Since telnet sends all data, including usernames and passwords, over the network in clear text, it is not often used anymore. Despite the other protocols that have come to replace it, telnet remains an ideal utility to test the connection to a certain port of a device, and can be handy in other niche scenarios, or even send an email.
After establishing a successful telnet connection, you will eventually want to quit out and return to your regular terminal. In this tutorial, we will show you how to quit a telnet session on a Linux system.
In this tutorial you will learn:
- How to quit telnet
|Category||Requirements, Conventions or Software Version Used|
|System||Any Linux distro|
|Other||Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
How to quit telnet on Linux step by step instructions
- First, let’s use the
telnetcommand to connect to a listening service:
$ telnet example.com 80 Trying 18.104.22.168... Connected to example.com. Escape character is '^]'.
You will notice in the above output, the last line which says
Escape character is '^]'.. In Linux, the
^character is commonly used to represent the
Ctrlkey on your keyboard. So, this text is telling us that pressing the
]key while holding down
Ctrlis an escape sequence.
- By escaping from the telnet connection, we can pass different commands to telnet while not interfering with the connection that we already have established. So, let’s use the
Ctrl + ]combination.
As you can see, the telnet prompt has changed, which indicates that we have entered command mode and can pass other commands to telnet, independent of the stream we have open.
- This mode will accept the
quitcommand, which tells telnet to close the connection we have open. Our terminal will then return to a regular prompt, outside of telnet.
telnet> quit Connection closed.
The steps above show the proper and intended way to quit out of a telnet connection. However, to quit more quickly (and less gracefully), you could also use the
Ctrl + Ccombination. This is a well known key combo which can be used to immediately quit out of the majority of running processes in your Linux terminal.
In this tutorial, we saw how to quit out of a telnet connection on a Linux system. Although telnet is not commonly used these days, knowing some basics about the command can be super handy for Linux administrators that need a quick, no frills tool to test the connectivity to a certain port on a local or remote server.