user interface to the TELNET protocol
telnet [-8] [-a] [-D] [-d] [-e escape_char]
[-n tracefile] [[-l user] host [port]]
- -8
- Allow an eight-bit input data path at all times. Without
this option, parity bits are stripped whenever the remote
side's stop and start characters are ^S and
^Q.
- -a
- Attempt automatic login. Currently, this sends the
username 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()) if that name agrees with the current
user ID. Otherwise, the name used is the one associated with
the user ID.
- -D
- Disable telnet escape character.
- -d
- Set the initial value of the debug toggle to TRUE.
- -e escape_char
- Set the initial telnet escape character to
escape_char (default is
Ctrl
-]
). This
character lets you switch to telnet's command
mode.
- -l user
- When connecting to the remote system, if the remote
system understands the ENVIRON option, send user
to the remote system as the value for the variable USER.
This option implies the -a option and may may
also be used with the open command.
- -n tracefile
- Record trace information in the specified file. See the
set tracefile command, below.
- host
- The official name, an alias, or the Internet address of
a remote host.
- port
- A port number (address of an application). If a number
isn't specified, the default telnet port is used.
You use the telnet command to communicate with
another host via the TELNET protocol. If you invoke
telnet without a host argument, it
enters command mode and displays this prompt:
telnet>
In command mode, telnet accepts and executes the
commands listed in the following section, ``Telnet commands.''
If you invoke telnet with a host
argument, it opens a connection to the named host (i.e. it
performs an open command).
If 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 (in most cases) only completed lines are sent
to the remote host. You can use the ``local echo
character'' (initially
Ctrl
-E
) to turn off and on
the local echo (you would use this mostly 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''), your 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 your susp
and eof are also sent as TELNET protocol sequences,
and quit is sent as a TELNET ABORT instead of as a
TELNET BREAK. There are options (see toggle autoflush and
toggle autosynch below) that cause this action to
flush subsequent terminal output (until the remote host
acknowledges the TELNET sequence) and to flush previous
terminal input (in the case of quit and
intr).
While you're connected to a remote host, you can enter
telnet's command mode by entering the
telnet escape sequence (initially
Ctrl
-]
). The
normal terminal editing conventions are available in command
mode.
In the following commands, you need to type only enough of
each command to uniquely identify it; this is also TRUE for
arguments to the mode, set,
toggle, unset, slc,
environ, and display commands.
- close
- Close a TELNET session and return to command mode.
- display argument...
- Display all, or some, of the set and toggle values (see
below).
- mode type
- The type argument can have one of several
values, depending on the state of the TELNET session. The
remote host is asked for permission to go into the requested
mode. If the remote host can enter that mode, the mode will
be entered.
- ?
- Print out help information for the mode command.
- character
- Disable the TELNET LINEMODE option; if the remote side
doesn't understand the LINEMODE option, enter
character-at-a-time mode instead.
- line
- Enable the TELNET LINEMODE option; if the remote side
doesn't understand the LINEMODE option, attempt to enter
old-line-by-line mode instead.
- [-]edit
- Attempt to enable (disable) the EDIT mode of the
LINEMODE option. LINEMODE must be enabled.
- [-]isig
- Attempt to enable (disable) the TRAPSIG mode of the
LINEMODE option. LINEMODE must be enabled.
- [-]litecho
- Attempt to enable (disable) the LIT_ECHO mode of the
LINEMODE option. LINEMODE must be enabled.
- [-]softtabs
- Attempt to enable (disable) the SOFT_TAB mode of
the LINEMODE option. LINEMODE must be enabled.
- open host [[-l] user] [-port]
- Open a connection to the named host. If no port number
is specified, telnet will try to contact a TELNET
server at the default port. The host may be specified either
as a hostname (see the hosts file) or as an
Internet address specified in the ``dot notation''
(see the Internet address manipulation routines,
inet*()).
.
With the -l option, you can specify the username
to be passed to the remote system via the ENVIRON option.
When connecting to a nonstandard port, telnet
omits any automatic initiation of TELNET options. When
port is preceded by a minus sign, the initial
option negotiation is done. Once telnet
establishes a connection, it opens the
.telnetrc file that's in your home directory.
In this file, lines beginning with a pound sign (#) are
comments. Blank lines are ignored. Lines that begin without
whitespace are the start of a machine entry. The first thing
on the line is the name of the machine that's being
connected to. The rest of the line and the successive lines
that begin with whitespace are assumed to be
telnet commands; they're processed as if you had
typed them manually at the telnet> command
prompt.
- quit
- Close any open TELNET session and exit
telnet. An end-of-file (in command mode) will
also close a session and exit.
- send arguments
- Send one or more special character sequences to the
remote host. You can specify the following arguments (more
than one argument may be specified at a time):
- ?
- Print out help information for the send command.
- abort
- Send the TELNET ABORT (Abort processes) sequence.
- ao
- Send the TELNET AO (Abort Output) sequence, which
should cause the remote system to flush all its output to the user's
terminal.
- ayt
- Send the TELNET AYT (Are You There) sequence, to
which the remote system may or may not choose to respond.
- brk
- Send the TELNET BRK (Break) sequence, which may have
significance to the remote system.
- ec
- Send the TELNET EC (Erase Character) sequence, which
should cause the remote system to erase the last character entered.
- el
- Send the TELNET EL (Erase Line) sequence, which should
cause the remote system to erase the line currently being entered.
- eof
- Send the TELNET EOF (end-of-file) sequence.
- eor
- Send the TELNET EOR (end-of-record) sequence.
- escape
- Send the current telnet escape character
(initially
Ctrl
-]
).
- ga
- Send the TELNET GA (Go Ahead) sequence, which likely
has no significance to the remote system.
- getstatus
- If the remote side supports the TELNET STATUS command,
send the subnegotiation to request that the server send its
current option status.
- ip
- Send the TELNET IP (Interrupt Process) sequence, which
should cause the remote system to abort the currently
running process.
- nop
- Send the TELNET NOP (No OPeration) sequence.
- susp
- Send the TELNET SUSP (SUSPend process) sequence.
- synch
- Send the TELNET SYNCH sequence. This sequence causes
the remote system to discard all previously typed (but not yet read)
input. This sequence is sent as TCP urgent data - it might not
work if the remote system is a 4.2BSD system. If it doesn't work,
a lowercase ``r'' might be echoed on the terminal.
- set argument value
unset argument value
- The set command will set any one of a number
of telnet variables to a specific value or to
TRUE. The special value off turns off the
function associated with the variable-this is
equivalent to using the unset command. The
unset command will disable or set to FALSE any of
the specified functions.
You can query the values of variables with the
display command.
The telnet variables that can be set or unset,
but not toggled, are listed here. Note that you
also explicitly set or unset any of the toggle
command's variables.
- ?
- Display the legal set (unset) commands.
- echo
- In old-line-by-line mode, this value (initially
Ctrl
-E
) toggles
between doing local echoing of entered characters (for
normal processing) and suppressing echoing of entered
characters (e.g. for entering a password).
- eof
- If telnet is operating in LINEMODE or
old-line-by-line mode, this character will be sent to the
remote system if entered as the first character on a line.
The initial value of the eof character is the terminal's eof
character.
- erase
- If telnet is in localchars mode (see
toggle localchars below) and in
character-at-a-time mode, then when this character is
typed, a TELNET EC sequence (see send
ec above) is sent to the remote system. The
initial value for the erase character is the terminal's
erase character.
- escape
- This is the telnet escape character;
entering it switches you to telnet's command mode
when telnet is connected to a remote system.
(Initially, the character is
Ctrl
-]
to switch).
- flushoutput
- If telnet is in localchars mode (see
toggle localchars below) and the
flushoutput character is typed, a TELNET AO
sequence (see send ao above) is sent
to the remote host. The initial value for the flush
character is the terminal's flush character.
- interrupt
- If telnet is in localchars mode (see
toggle localchars below) and the
interrupt character is typed, a TELNET IP sequence (see
send ip above) is sent to the remote
host. The initial value for the interrupt character is the
terminal's intr character.
- kill
- If telnet is in localchars mode (see
toggle localchars below) and in
character-at-a-time mode, then when this character is typed,
a TELNET EL sequence (see send el
above) is sent to the remote system. The initial value for
the kill character is the terminal's kill character.
- lnext
- If telnet is in LINEMODE or old-line-by-line mode, then
this character is the terminal's lnext> character. The
initial value for the lnext character is the terminal's
lnext character.
- quit
- If telnet is in localchars mode (see
toggle localchars below) and the
quit character is typed, a TELNET BRK sequence (see
send brk above) is sent to the remote
host. The initial value for the quit character is the
terminal's quit character.
- reprint
- If telnet is in LINEMODE or old-line-by-line
mode, then this character is the terminal's reprint
character. The initial value for the reprint character is
the terminal's reprint character.
- start
- If the TELNET TOGGLE-FLOW-CONTROL option has been
enabled, then this character is the terminal's start
character. The initial value for the kill character is the
terminal's start character.
- stop
- If the TELNET TOGGLE-FLOW-CONTROL option has been
enabled, then this character is the terminal's stop
character. The initial value for the kill character is the
terminal's stop character.
- susp
- If telnet is in localchars mode, or if
LINEMODE is enabled, and the suspend character is typed, a
TELNET SUSP sequence (see send susp
above) is sent to the remote host. The initial value for the
suspend character is the terminal's suspend character.
- tracefile
- The file where the output (caused by netdata or
options tracing being TRUE) will be written. If it's set to
``-'', then tracing information will be written
to standard output (the default).
- worderase
- If telnet is operating in LINEMODE or
old-line-by-line mode, then this character is the terminal's
worderase character. The initial value for the worderase
character is the terminal's worderase character.
- slc state
- The slc command (Set Local Characters) sets
or changes the state of the special characters when the
TELNET LINEMODE option has been enabled. Special characters
are characters that get mapped to TELNET command sequences
(like ip or quit) or line-editing
characters (like erase and kill).
By default, the local special characters are exported.
- ?
- Print out help information for the slc command.
- check
- Verify the current settings for the current special
characters. The remote side is requested to send all the
current special-character settings. If there are any
discrepancies with the local side, the local side will
switch to the remote value.
- export
- 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.
- import
- 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 was
established.
- environ argument...
- The environ command manipulates the variables
that may be sent through the TELNET ENVIRON option. The
initial set of variables is taken from the user's
environment, with only the DISPLAY and
PRINTER variables being exported by default.
The USER variable is also exported when you
invoke telnet with -a or
-l. Valid arguments are:
- ?
- Print out help information for the environ command.
- define variable value
- Define this variable to have this
value. Any variables defined by this command
aren't automatically exported. To include
Tabs and Spaces in value,
enclose it in single or double quotes.
- export variable
- Mark variable to be exported to the remote side.
- list
- List the current set of environment variables. Those
marked with a * will be sent automatically; other variables
will be sent only if explicitly requested.
- send variable
- Send variable to the remote site.
- undefine variable
- Remove variable from the list of environment variables.
- unexport variable
- Mark variable not to be exported
unless explicitly asked for by the remote side.
- toggle flag...
- Toggle between TRUE and FALSE various flags that control
how telnet responds to events. You can explicitly
set these flags to TRUE or FALSE with the set
and unset commands listed above. To query the
state of these flags, use the display command.
Note that you can specify more than one flag.
Valid arguments are:
- ?
- Display the legal toggle commands.
- autoflush
- If autoflush and localchars are both
TRUE, and the ao or quit characters are
recognized (and transformed into TELNET sequences; see
set above for details), refuse 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. If the terminal user
hasn't done an stty noflsh, the initial value for
this toggle is TRUE; otherwise it is FALSE. See
stty.
- autosynch
- If autosynch and localchars are
both TRUE, and either the intr or quit
character is typed (see set above), send the
resulting TELNET sequence and follow it with 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. The initial value of this toggle is FALSE.
- binary
- Enable or disable the TELNET BINARY option on both
input and output.
- crlf
- If this is TRUE, send carriage returns as
CR LF. If this is FALSE, send
carriage returns as CR NUL. The
initial value for this toggle is FALSE.
- crmod
- 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. This mode doesn't affect characters you type,
only those received from the remote host. This mode is
useful only if the remote host sends only carriage returns
and never sends line feeds. The initial value for this
toggle is FALSE.
- debug
- Toggle socket-level debugging (useful only to the
superuser). The initial value for this toggle is FALSE.
- inbinary
- Enable or disable the TELNET BINARY option on input only.
- localchars
- If this is TRUE, then the flush,
interrupt, quit, erase, and
kill characters (see set above) are
recognized locally, and should be transformed into
appropriate TELNET control sequences (respectively
ao, ip, brk, ec,
and el; see send above). The initial
value for this toggle is TRUE in old-line-by-line mode, and
FALSE in character-at-a-time mode. When the LINEMODE option
is enabled, the value of localchars is ignored
and assumed to be always TRUE. If LINEMODE has ever been
enabled, then quit is sent as abort,
and eof and susp are sent as
eof and susp (see send
above).
- netdata
- Toggle the display of all network data (in hex format).
The initial value for this toggle is FALSE.
- options
- Toggle the display of some internal telnet protocol
processing (having to do with TELNET options). The initial
value for this toggle is FALSE.
- outbinary
- Enable or disable the TELNET BINARY option on output
only.
- prettydump
- If the netdata and prettydump
toggles are both enabled, the output from the
netdata command will be formatted in a more
user-readable format. 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 it.
- z
- Suspend telnet. This command works only if
you're using csh.
- ! [command]
- Execute a single command in a subshell on the local
system. If command is omitted, an interactive
subshell is invoked.
- status
- Show the current status of telnet. This
includes the peer you're connected to as well as the current
mode.
- ? [command]
- Get help. With no arguments, telnet prints a
help summary. If a command is specified, telnet
will print the help for that command.
- $HOME/.telnetrc
- User-customized startup values for telnet.
The telnet utility uses at least the
HOME, SHELL,
DISPLAY, and TERM environment
variables. The environment variables may be propagated to
the other side via the TELNET ENVIRON option.
On some remote systems, you have to turn echo off manually
when you're in old-line-by-line mode.
In old-line-by-line mode or LINEMODE, the terminal's EOF
character is recognized (and sent to the remote system) only
when it's the first character on a line.
rlogin,
rsh,
telnetd,
RFC 854