telnet(1) CLIX telnet(1)
NAME
telnet - Runs a user interface to the TELNET protocol
SYNOPSIS
telnet [host [port]]
DESCRIPTION
The telnet command is a virtual terminal program which uses the TELNET
protocol to communicate with the specified host.
If telnet is invoked without arguments, it enters command mode, indicated
by the telnet> prompt. In this mode, it accepts and executes the commands
listed in the Commands subsection. If it is invoked with arguments, it
performs an open command (see the Commands subsection) with the specified
arguments.
The telnet command searches the user's home directory for a .telnetrc file
that can be used to specify default settings.
Once a connection is opened, telnet enters an input mode. The input mode
entered will be either character-at-a-time or line-by-line, depending on
what the remote system supports.
In character-at-a-time mode, most text entered is immediately sent to the
remote host for processing.
In 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 the <Ctrl-E> sequence, will turn the local echo off and on.
(This would mostly be used to enter passwords without the password being
echoed.)
In either mode, if the localchars toggle is TRUE (the default in line-by-
line mode), the user's QUIT and INTR characters are trapped locally and
sent as TELNET protocol sequences to the remote side. Some options
(toggle autosynch) 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).
While connected to a remote host, the user may enter telnet command mode
by keying in the telnet escape character (initially the <Ctrl-]>
sequence). In command mode, the normal terminal editing conventions are
available.
Commands
The following commands are available. Only enough of each command to
uniquely identify it needs to be entered. (This is also true for
2/94 - Intergraph Corporation 1
telnet(1) CLIX telnet(1)
arguments to the mode, set, toggle, and display commands).
open host [port] Opens a connection to the named host. If a port number
is not specified, telnet will attempt to contact a
TELNET server at the default port. The host
specification may be either a hostname (see hosts) or
an Internet address specified in the dot notation (see
inet).
close Closes a TELNET session and returns to command mode.
quit Closes any open TELNET session and exits telnet. An
end-of-file (in command mode) will also close a session
and exit.
z Suspends telnet. This command works only when using
csh or ksh.
mode type Specifies the mode. The type parameter is either line
(for line-by-line mode) or character (for character-
at-a-time mode). The remote host is asked for
permission to enter the requested mode. If the remote
host can enter that mode, the requested mode will be
entered.
status Shows the current status of telnet. This includes the
peer the user is connected to and the current mode.
display [argument ... ]
Displays all or some of the set and toggle values (see
below).
? [command] Accesses help. With no arguments, telnet displays a
help summary. If a command is specified, telnet will
display the help information for that command only.
send arguments Sends one or more special character sequences to the
remote host. The following arguments may be specified.
(More than one argument may be specified at a time.)
escape Sends the current telnet escape character,
initially the <Ctrl-]> sequence.
synch Sends the TELNET SYNCH sequence. This
sequence causes the remote system to discard
all previously entered (but not yet read)
input. This sequence is sent as Transmission
Control Protocol (TCP) urgent data. (This may
not work if the remote system is a 4.2
Berkeley Software Distribution (BSD) system.
If it does not work, a lowercase ``r'' may be
2 Intergraph Corporation - 2/94
telnet(1) CLIX telnet(1)
echoed on the terminal).
brk Sends the TELNET BRK (BReaK) sequence, which
may be significant to the remote system.
ip Sends the TELNET IP (Interrupt Process)
sequence, which should cause the remote system
to abort the currently running process.
ao Sends the TELNET AO (Abort Output) sequence,
which should cause the remote system to flush
all output from the remote system to the
user's terminal.
ayt Sends the TELNET AYT (Are You There) sequence,
to which the remote system may or may not
choose to respond.
ec Sends the TELNET EC (Erase Character)
sequence, which should cause the remote system
to erase the last character entered.
el Sends the TELNET EL (Erase Line) sequence,
which should cause the remote system to erase
the line currently being entered.
ga Sends the TELNET GA (Go Ahead) sequence, which
likely is not significant to the remote
system.
nop Sends the TELNET NOP (No OPeration) sequence.
? Displays help information for the send
command.
set argument value Sets any one of a number of telnet variables to a
specific value. The special value off turns off the
function associated with the variable. The values of
variables may be interrogated with the display command.
The variables that may be specified are as follows:
echo This is the value (initially the <Ctrl-E>
sequence) that, when in line-by-line mode,
toggles between echoing entered characters
locally (for normal processing), and
suppressing echoing of entered characters
(such as for entering a password).
escape This is the telnet escape character,
initially the <Ctrl-]> sequence, that
causes telnet to enter command mode (when
2/94 - Intergraph Corporation 3
telnet(1) CLIX telnet(1)
connected to a remote system).
interrupt If telnet is in localchars mode (see the
toggle localchars description) and the INTR
character is keyed in, a TELNET IP sequence
(see the send ip description) is sent to
the remote host. The initial value for the
interrupt character is interpreted as the
terminal's INTR character.
quit If telnet is in localchars mode (see the
toggle localchars description) and the QUIT
character is entered, a TELNET BRK sequence
(see the send brk description) is sent to
the remote host. The initial value for the
quit character is interpreted as the
terminal's QUIT character.
erase If telnet is in localchars mode (see the
toggle localchars description) and telnet
is operating in character-at-a-time mode,
when this character is entered, a TELNET EC
sequence (see the send ec description) is
sent to the remote system. The initial
value for the erase character is
interpreted as the terminal's ERASE
character.
kill If telnet is in localchars mode (see the
toggle localchars description) and telnet
is operating in character-at-a-time mode,
when this character is entered, a TELNET EL
sequence (see the send el description) is
sent to the remote system. The initial
value for the kill character is interpreted
as the terminal's KILL character.
eof char If telnet is operating in line-by-line
mode, entering this character as the first
character on a line will cause this
character to be sent to the remote system.
The initial value of the end-of-file
character is interpreted as the terminal's
EOF character.
toggle argument ...
Toggles (between TRUE and FALSE) various flags that
control how telnet responds to events. More than one
argument may be specified. The state of these flags
may be interrogated with the display command. Valid
arguments are as follows:
4 Intergraph Corporation - 2/94
telnet(1) CLIX telnet(1)
localchars If this is TRUE, the INTR, QUIT, ERASE, and KILL
characters (see the set description) are recognized
locally and transformed into appropriate TELNET control
sequences (ao for TRUE, ip for INTR, brk for QUIT, ec
for ERASE, and el for KILL; see the send description).
The initial value for this toggle is TRUE in line-by-
line mode and FALSE in character-at-a-time mode.
autosynch If autosynch and localchars are both TRUE, when the
INTR or QUIT characters are entered, the resulting
TELNET sequence sent is followed by the TELNET SYNCH
sequence. (See the set description for descriptions of
the INTR and QUIT characters.) This procedure should
cause the remote system to begin discarding all
previously entered input until both of the TELNET
sequences have been read and acted on. The initial
value of this toggle is FALSE.
crmod Toggles carriage return mode. When this mode is
enabled, most carriage return characters received from
the remote host will be mapped to a carriage return
followed by a linefeed. This mode does not affect
characters entered by the user; only those received
from the remote host are affected. This mode is not
useful unless the remote host only sends a carriage
return, but it never sends a linefeed. The initial
value for this toggle is FALSE.
debug Toggles socket-level debugging. (This is useful only
to the superuser.) The initial value for this toggle
is FALSE.
options Toggles the display of some internal telnet protocol
processing (concerning TELNET options). The initial
value for this toggle is FALSE.
netdata Toggles the display of all network data (in hexadecimal
format). The initial value for this toggle is FALSE.
? Displays the legal toggle commands.
EXAMPLES
1. To enter the telnet client program to run interactively, enter:
telnet
This returns a telnet> prompt. To determine the available commands of
the telnet client program, enter a question mark (?).
2. To remotely login to the host sam using the TELNET protocol, enter:
2/94 - Intergraph Corporation 5
telnet(1) CLIX telnet(1)
telnet sam
3. To remotely login to the host sam using the port 1030, enter:
telnet sam 1030
This causes telnet to attempt to connect to port 1030 on host sam.
There must be a server listening at port 1030 on the remote host sam
for the connection to be established.
FILES
/etc/hosts
Hostname database.
/etc/resolv.conf
Domain Name System (DNS) client configuration file. DNS is the
preferred method for address resolution.
/etc/services
Service name database.
NOTES
On some remote systems, echo must be turned off manually in line-by-line
mode.
In line-by-line mode, the terminal's EOF character is recognized (and sent
to the remote system) only when it is the first character on a line.
If there is an error in the .telnetrc file, an error message will be
returned, but the telnet command will continue to process.
DIAGNOSTICS
telnet: tcp/telnet unknown service
The /etc/services file on your system needs to be updated.
The perror() function displays system errors on the following connection-
related function calls: select(), send(), setsockopt(), socket(),
connect().
EXIT VALUES
The telnet process exits with a value of 1 if the connection is broken
remotely (for example, keying in <Ctrl-D> to terminate the connection), or
if the telnet service is not found (see services).
An exit value of 0 is returned if quit is entered at the telnet> prompt or
if an error occurs during a setjmp() function call.
6 Intergraph Corporation - 2/94
telnet(1) CLIX telnet(1)
RELATED INFORMATION
Commands: csh(1), ksh(1), visit(1), rlogin(1), telnetd(8)
Functions: inet(3)
Files: hosts(4), /etc/resolv.conf(4), .telnetrc(4)
2/94 - Intergraph Corporation 7