telnet -- user interface to the TELNET† protocol
telnet [-468EFKLNacdfruxy] [-S tos] [-X authtype] [-e escapechar] [-k realm] [-l user] [-n tracefile]
[-s src_addr] [host [port]]
Frequently used to communicate to a login shell at another host using the TELNET protocol.
Invoked without the host argument, enters command mode, prompt
telnet> and accepts and executes the commands.
With arguments, it performs an open command with those arguments.
|if the remote system understands the |
user will be sent to the remote system as the value for the variable
may be used with the open command.
|Specifies a user interface similar to rlogin(1). |
In this mode, the escape character is set to the tilde (
| Sets telnet escape character used to invoke telnet command mode . |
ec is omitted, there will be no escape character.
| Stops any character from being recognized as an escape character to invoke telnet command mode.
|no automatic login to the remote system.
| automatic login. the default, so this option is ignored. |
sends the user name via the USER variable of the ENVIRON option if supported by the remote system.
The name used is that of the current user as returned by getlogin(2) if it agrees with
the current user ID, otherwise it is the name associated with the user ID.
| Forces IPv4 addresses only.
| Forces IPv6 addresses only.
| an 8-bit data path. This causes negotiating the TELNET BINARY option on both input and output.
| an 8-bit data path on output. This causes the BINARY option to be negotiated on output.
| Prevents IP address to name lookup when destination host is given as an IP address.
| Sets the IP type-of-service (TOS) which can
be a numeric or symbolic TOS name found in the |
| Disables the |
atype type of authentication.
| Sets debug toggle to TRUE.
|If Kerberos V5 authentication is being used, local credentials are forwarded to the remote system.
| " " including any credentials that have already been forwarded into the local environment.
|If Kerberos authentication telnets obtain tickets for the remote host in realm instead of the remote host's realm, as determined by krb_realmofhost(3).
|Opens tracefile for recording trace information. See the |
|Set the source IP address for the telnet connection to |
src_addr, which can be an IP address or a host name.
| Forces telnet to use AF_UNIX addresses only (e.g., UNIX domain sockets, accessed with a file path).
| Turns on encryption of the data stream if possible. the default, so this option is ignored.
|Suppresses encryption of the data stream.
|name, alias, or the Internet address of a remote host. If |
/, telnet establishes a connection to the corresponding named socket.
| port number (address of an application). If a number is not specified, the default
telnet port (|
This can be used for debugging many protocols since many use a plain text exchange. For example
telnet host 25 will
host Simple Mail Transport Protocol (SMTP, outgoing email) application which expects commands like
HELP, HELO,EHLO, MAIL FROM, SEND FROM, DATA …
Another example is to test connection to a QL server using
|Disables the reading of |
.telnetrc . (See
In rlogin mode, a line of the form
~. disconnects from the remote host; (
~ is the default escape character).
~^Z suspends the session.
~^] escapes to the normal telnet escape prompt.
Once a connection has been opened, telnet will attempt 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 will also relay 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) may be used to 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 subse-
quent output to the terminal (until the remote host acknowledges the TELNET sequence) and flush previ-
ous terminal input (in the case of quit and intr).
While connected to a remote host, telnet command mode may be entered by typing the telnet escape
character (initially ^]). When in command mode, the normal terminal editing conventions are available.
The following telnet commands are available.
Only enough of each command to uniquely identify it need
be typed (also true for arguments to
mode, set, toggle, unset, slc, environ, and display).
open host [-l user] [[-]port]
host host name, address in dot notation, or IPv6 coloned-hexadecimal addreess.
-l login user name passed to the remote system via
When connecting to a non-standard port, telnet omits any automatic initiation of TELNET options.
port is preceded by a minus sign, the initial option negotiation is done.
After establishing a connection,
.telnetrc in the users home directory is opened.
| Close a TELNET session and return to command mode.
|Sends the TELNET LOGOUT option to the remote side, similar to a |
if the remote side does not support the LOGOUT option, nothing happens.
If the remote side does support the LOGOUT option, this command should cause the remote side to close the TELNET connection.
If the remote side also supports the concept of suspending a user's session for later reattachment,
logout argument indicates terminate the session immediately.
auth disable type enable
manipulates the TELNET AUTHENTICATE option.|
To a list of available
auth disable ?
| Lists the current status of the various types of authentication.|
encrypt argument ...
enable type [input | output]
| Omitting |
input or output,
both are disabled.
To list available
encrypt disable ?
stop [input | output]
output both are encrypted.
encrypt stop(stop) input
encrypt start (stop) output
| Sets the default |
environ args …
The initial set of variables is populated with the contents of: |
USER, PRINTER, DISPLAY, TERM, COLUMNS, LINES.
USER, PRINTER, DISPLAY are exported by default.
Valid arguments for the environ command are:
define variable [value]
|Define the variable variable to have a value of value. If value is empty, the
value is taken from the environment variable. Any variables defined by this
command are automatically exported. The value may be enclosed in single or dou-
ble quotes so that tabs and spaces may be included.
| Remove |
variable from the list of environment variables.
| Mark |
variable to be exported to the remote side.
| Mark |
variable to not be exported unless explicitly asked for by the
|List the current set of environment variables. Those marked with a * will be
sent automatically, other variables will only be sent if explicitly requested.
| output help for |
| Disable TELNET LINEMODE. |
If the remote side does not understand LINEMODE ,
enter character at a time mode.
|Enable the TELNET LINEMODE option, |
If the remote side does not understand LINEMODE, then enter old-line-by-line mode.
|enable (disable) TRAPSIG
|enable (disable) EDIT
| enable (disable) SOFT_TAB
| enable (disable) LIT_ECHO
| output help for |
| More than one argument may be specified
| Are You There
| Erase Character erases the last character entered.
| Erase Line erases the line currently being entered.
| End Of File
| End of Record
| current telnet escape character, initially |
| Go Ahead
| server current option status.
| No OPeration
| Abort processes
| Abort Output causes the remote system to flush buffered output
|Interrupt Process abort the currently running process.
| SUSPend process |
| discard all previously typed (but not yet read) input. |
sent as TCP urgent data. If ignored a lower case r may be echoed on the terminal.
cmd decimal number between 0 and 255, or a symbolic name for a specific TELNET command.
? to output help information, including a list of known symbolic names.
| outputs help |
display argument ...
| Displays set and toggle values
telnet> display ayt
will flush output when sending interrupt characters.
won't send interrupt characters in urgent mode.
will send login name and/or authentication information.
won't skip reading of ~/.telnetrc file.
won't map carriage return on output.
will recognize certain control characters.
won't turn on socket level debugging.
won't print hexadecimal representation of network traffic.
won't print user readable output for "netdata".
won't show option processing.
won't print hexadecimal representation of terminal traffic.
echo [^E] escape [^]]
tracefile "(standard output)"
flushoutput [^O] interrupt [^C] quit [^\]
eof [^D] erase [^?] kill [^U]
lnext [^V] susp [^Z] reprint [^R]
worderase [^W] start [^Q] stop [^S]
forw1 [off] forw2 [off]
set code value|TRUE|off
unset code value|TRUE|off
variables which may be |
unset, but not
toggle command may be
set or unset
|enters command mode
|in line by line mode, toggles local echo of entered characters (for normal processing), and suppressing echoing (for example entering, a password)
|in LINEMODE or old line by line mode, as the first character on a line, causes this character to be sent
| ||in LINEMODE, cause partial lines to be forwarded
| in LINEMODE or old line by line mode
| in localchars mode, or LINEMODE , status character sends TELNET AYT
| affect input
|in localchars mode and operating in character at a time mode, sends TELNET EC
|^W|| in LINEMODE or old line by line mode,
| affect output
| If TOGGLE-FLOW-CONTROL is enabled
| If TOGGLE-FLOW-CONTROL is enabled
|in localchars mode and operating in character at a time mode, sends TELNET EL
|In localchars mode, sends TELNET AO
| in localchars mode, or LINEMODE is enabled, TELNET SUSP is sent.
|in localchars mode send TELNET IP
| localchars mode sends TELNET BRK
|in LINEMODE or old line by line mode,
|off|| If set, the escape character is ignored unless preceded by this character at the beginning of a line. |
At the beginning of a line followed by a "." closes the connection to be suspended
When followed by a
^Z suspends the telnet command.
|-|| filename to which the output, of |
-, then tracing information is written to standard output
| ||Displays the legal set (unset) commands.
|Set Local Characters|
in LINEMODE Special characters are characters mapped to TELNET commands sequences (like
or line editing characters (like
|Verify the current settings for the current special characters. The remote side
is requested to send all the current special character settings, and if there
are any discrepancies with the local side, the local side will switch to the remote value.
| Switch to the local defaults for the special characters. The local default
characters are those of the local terminal at the time when telnet was started.
| Switch to the remote defaults for the special characters. The remote default
characters are those of the remote system at the time when the TELNET connection
|output help information for the slc command.
|Show the current status of telnet. This includes the peer one is connected to, as well as the current mode.
toggle arguments ...
| use |
unset to explicitly set TRUE or FALSE
More than one argument may be specified. The state of these flags may be interrogated with the display command.
| Turns on debugging for the authentication code.
| If |
localchars are both TRUE, then when the ao, or quit characters are recognized (and transformed into TELNET sequences; telnet refuses to display any data on the user's terminal until the
remote system acknowledges (via a TELNET TIMING MARK option) that it has processed those TELNET sequences.
Initaly TRUE if the terminal user had not done an
stty noflsh", otherwise FALSE (see stty
| When the TELNET ENCRYPT option is negotiated, by default the actual encryption
(decryption) of the data stream does not start automatically. |
The autoencrypt (autodecrypt) command states that encryption of the output (input) stream should be enabled as soon as possible.
|If the remote side supports the TELNET AUTHENTICATION option telnet attempts
to use it to perform automatic authentication. If the AUTHENTICATION option
is not supported, the user's login name are propagated through the TELNET
ENVIRON option. This command is the same as specifying -a option on the open command.
| If autosynch and localchars are both TRUE, then when either the intr or quit
characters is typed (see set above for descriptions of the intr and quit characters), the resulting TELNET sequence sent is followed by the TELNET SYNCH
sequence. This procedure should cause the remote system to begin throwing
away all previously typed input until both of the TELNET sequences have been
read and acted upon. |
Enable or disable the TELNET BINARY option on i/o, input, output.
| carriage returns will be sent as ␍␊|
FALSE, then carriage returns will be send as ␍␀
initially FALSE ␍␀.
|Toggle carriage return mode. When this mode is enabled, most carriage return
characters received from the remote host will be mapped into a carriage return
followed by a line feed. |
Does not affect those characters typed by the user, only those received from the remote host.
This mode is not very
useful unless the remote host only sends carriage return, but never line feed.
|Toggles socket level debugging (useful only to the super user), initally FALSE.
| Turns on debugging information for the encryption code.
|If TRUE, flush, interrupt, quit, erase, and kill characters
are recognized locally, and transformed into
appropriate TELNET control sequences (respectively ao, ip, brk, ec and el
Initially TRUE in old line by line mode, and |
Initially FALSE in character at a time mode.
When LINEMODE is enabled, the value of localchars is ignored, and assumed to always be TRUE.
If LINEMODE has ever been enabled, then quit is sent as abort, and eof and suspend are sent as eof and susp (see send above).
|Toggles the display of terminal data (in hexadecimal ), initially FALSE.
|Toggles the display of network data (in hexadecimal ), initially FALSE.
netdata is enabled, more user readable format, i.e. spaces
are put between each character in the output, and the beginning of any telnet
escape sequence is preceded by a
* to aid in locating them.
|skips the reading of |
.telnetrc, initially FALSE.
|output a message each time encryption is enabled or disabled. initially FALSE.
| Displays toggle commands.
opie sequence challenge
|computes a response to the OPIE challenge.
| Suspend telnet. resume with |
|Execute a single command in a subshell on the local system. |
If command is omitted, then an interactive subshell is invoked.
|Toggles the display of some internal telnet protocol processing, initially FALSE.
| With no arguments, outputs a summary of commands. |
If command is specified, outputs the help information for that command.
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.
rlogin(1), rsh(1), hosts(5), nologin(5), telnetd(8)
~/.telnetrc user customized telnet startup values
Lines beginning with a # are comment lines. Blank lines are ignored.
Lines that begin without white space are the start of a machine entry.
machine The rest of the line, and successive lines that
begin with white space are telnet commands ..
The telnet command appeared in 4.2BSD.
IPv6 support was added by WIDE/KAME project.
On some remote systems, echo has to be turned off manually when in old line by line mode.
In old line by line mode or LINEMODE the terminal's eof character is only recognized (and sent to
the remote system) when it is the first character on a line.
/etc/iptos file configures the Type Of Service (TOS) of the Internet
Protocol (IP) used by FTP and Telnet.
The TOS field in the Internet datagram is to specify how the datagram
should be handled. It is a mechanism to allow control information to have
precedence over data.
Generally, protocols that are involved in direct interaction with a human
should select low delay, while data transfers that involve large blocks of
data need high throughput.
Finally, high reliability is most important for
datagram-based Internet management functions.
In the Tru64 UNIX operating system, the ftp and telnet applications and the
ftpd and telnetd daemons allow the configuring of
If the file does not exist, the applications default to recommended by RFC1060:
ftp-control Low delay
ftp-data High throughput
telnet Low delay
Users who want to configure their own TOS values for the TOS field should
provide the /etc/iptos file.
Most IP routers do not differentiate based on TOS, and therefore providing
values other than the default would have no affect. Digital does not
recommend changing the default values for FTP and Telnet.
Application Proto TOS-bits aliases
Items on an entry line are separated by any number of blanks, tabs, or
combination of blanks and tabs. A number sign (#) indicates that the rest
of the line is a comment and is not interpreted by routines that search the
file. Blank lines in the file are ignored.
| The name of an application TOS entry.
| The protocol name for which the entry is appropriate.
| The TOS value to be set for the entry.
| A list of aliases that exist for the entry.
Valid TOS entry names are
ftp-data for FTP and
telnet for Telnet.
The TOS value for the entry should be one of the following hexadecimal
numbers, corresponding to TOS bits:
Not included in Apple Mac os
nc is a far more appropriate and capable tool than telnet for connecting to random ports for testing,