The telnet program is a user interface to the TELNET protocol.
Description
The telnet command is used for interactive communication with another host using the TELNET protocol. It begins in command mode, where it prints a telnet command prompt (“telnet>”).
- Description
- Syntax
- Protocol
- Commands
- Environment
- Files
- Examples
- Related commands
- Linux commands help
If telnet is invoked with a host argument, it performs an open command implicitly (see the Commands section below for details).
Syntax
telnet [-468ELadr] [-S tos] [-b address] [-e escapechar] [-l user] [-n tracefile] [host [port]]
Options
Protocol
Once a connection is opened, telnet attempts to enable the TELNET LINEMODE option. If this fails, then telnet will revert to one of two input modes: either “character at a time” or “old line by line” depending on what the remote system supports.
When LINEMODE is enabled, character processing is done on the local system, under the control of the remote system. When input editing or character echoing is to be disabled, the remote system will relay that information. The remote system also relays changes to any special characters that happen on the remote system, so that they can take effect on the local system.
In “character at a time” mode, most text typed is immediately sent to the remote host for processing.
In “old line by line” mode, all text is echoed locally, and (normally) only completed lines are sent to the remote host. The “local echo character” (initially “^E”) can turn off and on the local echo (this would mostly be used to enter passwords without the password being echoed).
If the LINEMODE option is enabled, or if the localchars toggle is TRUE (the default for “old line by line”; see below), the user’s quit, intr, and flush characters are trapped locally, and sent as TELNET protocol sequences to the remote side. If LINEMODE has ever been enabled, then the user’s susp and eof are also sent as TELNET protocol sequences, and quit is sent as a TELNET ABORT instead of BREAK. There are options (see toggle autoflush and toggle autosynch, below) which cause this action to flush subsequent output to the terminal (until the remote host acknowledges the TELNET sequence) and flush previous terminal input (in the case of quit and intr).
Commands
The following telnet commands are available. Unique prefixes are understood as abbreviations.
Environment
telnet uses at least the HOME, SHELL, DISPLAY, and TERM environment variables. Other environment variables may be propagated to the other side via the TELNET ENVIRON option.
Files
Examples
telnet myhost.com
Attempts to open a connection to the remote host myhost.com. If a connection is established, the host prompts for a login name and password.
telnet -l myusername myhost.com 5555
Attempts to open a connection to the remote host myhost.com on port 5555, using the login name myusername. If successful, the host prompts for myusername’s password.
telnet
Opens a local telnet> prompt, where you can enter any of the commands listed above. For example, entering the following command at the prompt:
telnet> open myhost.com
…attempts to open a connection to myhost.com, as in our first example.
Related commands
rlogin — Begin a session on a remote system.ssh — Login to a remote system securely.