1.\" Copyright (c) 1983, 1990, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\"    must display the following acknowledgement:
14.\"	This product includes software developed by the University of
15.\"	California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\"    may be used to endorse or promote products derived from this software
18.\"    without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\"	@(#)telnet.1	8.6 (Berkeley) 6/1/94
33.\"
34.Dd June 1, 1994
35.Dt TELNET 1
36.Os BSD 4.2
37.Sh NAME
38.Nm telnet
39.Nd user interface to the
40.Tn TELNET
41protocol
42.Sh SYNOPSIS
43.Nm telnet
44.Op Fl 78EFKLacdfrx
45.Op Fl S Ar tos
46.Op Fl X Ar authtype
47.Op Fl e Ar escapechar
48.Op Fl k Ar realm
49.Op Fl l Ar user
50.Op Fl n Ar tracefile
51.Oo
52.Ar host
53.Op port
54.Oc
55.Sh DESCRIPTION
56The
57.Nm telnet
58command
59is used to communicate with another host using the
60.Tn TELNET
61protocol.
62If
63.Nm telnet
64is invoked without the
65.Ar host
66argument, it enters command mode,
67indicated by its prompt
68.Pq Nm telnet\*[Gt] .
69In this mode, it accepts and executes the commands listed below.
70If it is invoked with arguments, it performs an
71.Ic open
72command with those arguments.
73.Pp
74Options:
75.Bl -tag -width indent
76.It Fl 8
77Specifies an 8-bit data path.  This causes an attempt to
78negotiate the
79.Dv TELNET BINARY
80option on both input and output.
81.It Fl 7
82Do not try to negotiate
83.Dv TELNET BINARY
84option.
85.It Fl E
86Stops any character from being recognized as an escape character.
87.It Fl F
88If Kerberos V5 authentication is being used, the
89.Fl F
90option allows the local credentials to be forwarded
91to the remote system, including any credentials that
92have already been forwarded into the local environment.
93.It Fl K
94Specifies no automatic login to the remote system.
95.It Fl L
96Specifies an 8-bit data path on output.  This causes the
97BINARY option to be negotiated on output.
98.It Fl S Ar tos
99Sets the IP type-of-service (TOS) option for the telnet
100connection to the value
101.Ar tos ,
102which can be a numeric TOS value
103or, on systems that support it, a symbolic
104TOS name found in the /etc/iptos file.
105.It Fl X Ar atype
106Disables the
107.Ar atype
108type of authentication.
109.It Fl a
110Attempt automatic login.
111Currently, this sends the user name via the
112.Ev USER
113variable
114of the
115.Ev ENVIRON
116option if supported by the remote system.
117The name used is that of the current user as returned by
118.Xr getlogin 2
119if it agrees with the current user ID,
120otherwise it is the name associated with the user ID.
121.It Fl c
122Disables the reading of the user's
123.Pa \&.telnetrc
124file.  (See the
125.Ic toggle skiprc
126command on this man page.)
127.It Fl d
128Sets the initial value of the
129.Ic debug
130toggle to
131.Dv TRUE
132.It Fl e Ar escape char
133Sets the initial
134.Nm
135.Nm telnet
136escape character to
137.Ar escape char .
138If
139.Ar escape char
140is omitted, then
141there will be no escape character.
142.It Fl f
143If Kerberos V5 authentication is being used, the
144.Fl f
145option allows the local credentials to be forwarded to the remote system.
146.It Fl k Ar realm
147If Kerberos authentication is being used, the
148.Fl k
149option requests that telnet obtain tickets for the remote host in
150realm realm instead of the remote host's realm, as determined
151by
152.Xr krb_realmofhost 3 .
153.It Fl l Ar user
154When connecting to the remote system, if the remote system
155understands the
156.Ev ENVIRON
157option, then
158.Ar user
159will be sent to the remote system as the value for the variable USER.
160This option implies the
161.Fl a
162option.
163This option may also be used with the
164.Ic open
165command.
166.It Fl n Ar tracefile
167Opens
168.Ar tracefile
169for recording trace information.
170See the
171.Ic set tracefile
172command below.
173.It Fl r
174Specifies a user interface similar to
175.Xr rlogin 1 .
176In this
177mode, the escape character is set to the tilde (~) character,
178unless modified by the -e option.
179.It Fl x
180Turn on encryption of the data stream.  When this option is turned on,
181.B telnet
182will exit with an error if authentication cannot be negotiated or if
183encryption cannot be turned on.
184.It Ar host
185Indicates the official name, an alias, or the Internet address
186of a remote host.
187.It Ar port
188Indicates a port number (address of an application).  If a number is
189not specified, the default
190.Nm telnet
191port is used.
192.El
193.Pp
194When in rlogin mode, a line of the form ~.  disconnects from the
195remote host; ~ is the telnet escape character.
196Similarly, the line ~^Z suspends the telnet session.
197The line ~^] escapes to the normal telnet escape prompt.
198.Pp
199Once a connection has been opened,
200.Nm telnet
201will attempt to enable the
202.Dv TELNET LINEMODE
203option.
204If this fails, then
205.Nm telnet
206will revert to one of two input modes:
207either \*(Lqcharacter at a time\*(Rq
208or \*(Lqold line by line\*(Rq
209depending on what the remote system supports.
210.Pp
211When
212.Dv LINEMODE
213is enabled, character processing is done on the
214local system, under the control of the remote system.  When input
215editing or character echoing is to be disabled, the remote system
216will relay that information.  The remote system will also relay
217changes to any special characters that happen on the remote
218system, so that they can take effect on the local system.
219.Pp
220In \*(Lqcharacter at a time\*(Rq mode, most
221text typed is immediately sent to the remote host for processing.
222.Pp
223In \*(Lqold line by line\*(Rq mode, all text is echoed locally,
224and (normally) only completed lines are sent to the remote host.
225The \*(Lqlocal echo character\*(Rq (initially \*(Lq^E\*(Rq) may be used
226to turn off and on the local echo
227(this would mostly be used to enter passwords
228without the password being echoed).
229.Pp
230If the
231.Dv LINEMODE
232option is enabled, or if the
233.Ic localchars
234toggle is
235.Dv TRUE
236(the default for \*(Lqold line by line\*(Lq; see below),
237the user's
238.Ic quit  ,
239.Ic intr ,
240and
241.Ic flush
242characters are trapped locally, and sent as
243.Tn TELNET
244protocol sequences to the remote side.
245If
246.Dv LINEMODE
247has ever been enabled, then the user's
248.Ic susp
249and
250.Ic eof
251are also sent as
252.Tn TELNET
253protocol sequences,
254and
255.Ic quit
256is sent as a
257.Dv TELNET ABORT
258instead of
259.Dv BREAK
260There are options (see
261.Ic toggle
262.Ic autoflush
263and
264.Ic toggle
265.Ic autosynch
266below)
267which cause this action to flush subsequent output to the terminal
268(until the remote host acknowledges the
269.Tn TELNET
270sequence) and flush previous terminal input
271(in the case of
272.Ic quit
273and
274.Ic intr  ) .
275.Pp
276While connected to a remote host,
277.Nm telnet
278command mode may be entered by typing the
279.Nm telnet
280\*(Lqescape character\*(Rq (initially \*(Lq^]\*(Rq).
281When in command mode, the normal terminal editing conventions are available.
282.Pp
283The following
284.Nm telnet
285commands are available.
286Only enough of each command to uniquely identify it need be typed
287(this is also true for arguments to the
288.Ic mode  ,
289.Ic set ,
290.Ic toggle  ,
291.Ic unset ,
292.Ic slc  ,
293.Ic environ ,
294and
295.Ic display
296commands).
297.Pp
298.Bl -tag -width "mode type"
299.It Ic auth Ar argument ...
300The auth command manipulates the information sent through the
301.Dv TELNET AUTHENTICATE
302option.  Valid arguments for the
303auth command are as follows:
304.Bl -tag -width "disable type"
305.It Ic disable Ar type
306Disables the specified type of authentication.  To
307obtain a list of available types, use the
308.Ic auth disable ?\&
309command.
310.It Ic enable Ar type
311Enables the specified type of authentication.  To
312obtain a list of available types, use the
313.Ic auth enable ?\&
314command.
315.It Ic status
316Lists the current status of the various types of
317authentication.
318.El
319.It Ic close
320Close a
321.Tn TELNET
322session and return to command mode.
323.It Ic display Ar argument ...
324Displays all, or some, of the
325.Ic set
326and
327.Ic toggle
328values (see below).
329.It Ic encrypt Ar argument ...
330The encrypt command manipulates the information sent through the
331.Dv TELNET ENCRYPT
332option.
333.Pp
334Note:  Because of export controls, the
335.Dv TELNET ENCRYPT
336option is not supported outside of the United States and Canada.
337.Pp
338Valid arguments for the encrypt command are as follows:
339.Bl -tag -width Ar
340.It Ic disable Ar type Xo
341.Op Cm input | output
342.Xc
343Disables the specified type of encryption.  If you
344omit the input and output, both input and output
345are disabled.  To obtain a list of available
346types, use the
347.Ic encrypt disable ?\&
348command.
349.It Ic enable Ar type Xo
350.Op Cm input | output
351.Xc
352Enables the specified type of encryption.  If you
353omit input and output, both input and output are
354enabled.  To obtain a list of available types, use the
355.Ic encrypt enable ?\&
356command.
357.It Ic input
358This is the same as the
359.Ic encrypt start input
360command.
361.It Ic -input
362This is the same as the
363.Ic encrypt stop input
364command.
365.It Ic output
366This is the same as the
367.Ic encrypt start output
368command.
369.It Ic -output
370This is the same as the
371.Ic encrypt stop output
372command.
373.It Ic start Op Cm input | output
374Attempts to start encryption.  If you omit
375.Ic input
376and
377.Ic output ,
378both input and output are enabled.  To
379obtain a list of available types, use the
380.Ic encrypt enable ?\&
381command.
382.It Ic status
383Lists the current status of encryption.
384.It Ic stop Op Cm input | output
385Stops encryption.  If you omit input and output,
386encryption is on both input and output.
387.It Ic type Ar type
388Sets the default type of encryption to be used
389with later
390.Ic encrypt start
391or
392.Ic encrypt stop
393commands.
394.El
395.It Ic environ Ar arguments ...
396The
397.Ic environ
398command is used to manipulate the
399the variables that my be sent through the
400.Dv TELNET ENVIRON
401option.
402The initial set of variables is taken from the users
403environment, with only the
404.Ev DISPLAY
405and
406.Ev PRINTER
407variables being exported by default.
408The
409.Ev USER
410variable is also exported if the
411.Fl a
412or
413.Fl l
414options are used.
415.Pp
416Valid arguments for the
417.Ic environ
418command are:
419.Bl -tag -width Fl
420.It Ic define Ar variable value
421Define the variable
422.Ar variable
423to have a value of
424.Ar value .
425Any variables defined by this command are automatically exported.
426The
427.Ar value
428may be enclosed in single or double quotes so
429that tabs and spaces may be included.
430.It Ic undefine Ar variable
431Remove
432.Ar variable
433from the list of environment variables.
434.It Ic export Ar variable
435Mark the variable
436.Ar variable
437to be exported to the remote side.
438.It Ic unexport Ar variable
439Mark the variable
440.Ar variable
441to not be exported unless
442explicitly asked for by the remote side.
443.It Ic list
444List the current set of environment variables.
445Those marked with a
446.Cm *
447will be sent automatically,
448other variables will only be sent if explicitly requested.
449.It Ic ?\&
450Prints out help information for the
451.Ic environ
452command.
453.El
454.It Ic logout
455Sends the
456.Dv TELNET LOGOUT
457option to the remote side.
458This command is similar to a
459.Ic close
460command; however, if the remote side does not support the
461.Dv LOGOUT
462option, nothing happens.
463If, however, the remote side does support the
464.Dv LOGOUT
465option, this command should cause the remote side to close the
466.Tn TELNET
467connection.
468If the remote side also supports the concept of
469suspending a user's session for later reattachment,
470the logout argument indicates that you
471should terminate the session immediately.
472.It Ic mode Ar type
473.Ar Type
474is one of several options, depending on the state of the
475.Tn TELNET
476session.
477The remote host is asked for permission to go into the requested mode.
478If the remote host is capable of entering that mode, the requested
479mode will be entered.
480.Bl -tag -width Ar
481.It Ic character
482Disable the
483.Dv TELNET LINEMODE
484option, or, if the remote side does not understand the
485.Dv LINEMODE
486option, then enter \*(Lqcharacter at a time\*(Lq mode.
487.It Ic line
488Enable the
489.Dv TELNET LINEMODE
490option, or, if the remote side does not understand the
491.Dv LINEMODE
492option, then attempt to enter \*(Lqold-line-by-line\*(Lq mode.
493.It Ic isig Pq Ic \-isig
494Attempt to enable (disable) the
495.Dv TRAPSIG
496mode of the
497.Dv LINEMODE
498option.
499This requires that the
500.Dv LINEMODE
501option be enabled.
502.It Ic edit Pq Ic \-edit
503Attempt to enable (disable) the
504.Dv EDIT
505mode of the
506.Dv LINEMODE
507option.
508This requires that the
509.Dv LINEMODE
510option be enabled.
511.It Ic softtabs Pq Ic \-softtabs
512Attempt to enable (disable) the
513.Dv SOFT_TAB
514mode of the
515.Dv LINEMODE
516option.
517This requires that the
518.Dv LINEMODE
519option be enabled.
520.It Ic litecho Pq Ic \-litecho
521Attempt to enable (disable) the
522.Dv LIT_ECHO
523mode of the
524.Dv LINEMODE
525option.
526This requires that the
527.Dv LINEMODE
528option be enabled.
529.It Ic ?\&
530Prints out help information for the
531.Ic mode
532command.
533.El
534.It Xo
535.Ic open Ar host
536.Op Fl l Ar user
537.Op Oo Fl Oc Ns Ar port
538.Xc
539Open a connection to the named host.
540If no port number
541is specified,
542.Nm telnet
543will attempt to contact a
544.Tn TELNET
545server at the default port.
546The host specification may be either a host name (see
547.Xr hosts  5  )
548or an Internet address specified in the \*(Lqdot notation\*(Rq (see
549.Xr inet 3 ) .
550The
551.Op Fl l
552option may be used to specify the user name
553to be passed to the remote system via the
554.Ev ENVIRON
555option.
556When connecting to a non-standard port,
557.Nm telnet
558omits any automatic initiation of
559.Tn TELNET
560options.  When the port number is preceded by a minus sign,
561the initial option negotiation is done.
562After establishing a connection, the file
563.Pa \&.telnetrc
564in the
565users home directory is opened.  Lines beginning with a # are
566comment lines.  Blank lines are ignored.  Lines that begin
567without white space are the start of a machine entry.  The
568first thing on the line is the name of the machine that is
569being connected to.  The rest of the line, and successive
570lines that begin with white space are assumed to be
571.Nm telnet
572commands and are processed as if they had been typed
573in manually to the
574.Nm telnet
575command prompt.
576.It Ic quit
577Close any open
578.Tn TELNET
579session and exit
580.Nm telnet  .
581An end of file (in command mode) will also close a session and exit.
582.It Ic send Ar arguments
583Sends one or more special character sequences to the remote host.
584The following are the arguments which may be specified
585(more than one argument may be specified at a time):
586.Pp
587.Bl -tag -width escape
588.It Ic abort
589Sends the
590.Dv TELNET ABORT
591(Abort
592processes)
593sequence.
594.It Ic ao
595Sends the
596.Dv TELNET AO
597(Abort Output) sequence, which should cause the remote system to flush
598all output
599.Em from
600the remote system
601.Em to
602the user's terminal.
603.It Ic ayt
604Sends the
605.Dv TELNET AYT
606(Are You There)
607sequence, to which the remote system may or may not choose to respond.
608.It Ic brk
609Sends the
610.Dv TELNET BRK
611(Break) sequence, which may have significance to the remote
612system.
613.It Ic ec
614Sends the
615.Dv TELNET EC
616(Erase Character)
617sequence, which should cause the remote system to erase the last character
618entered.
619.It Ic el
620Sends the
621.Dv TELNET EL
622(Erase Line)
623sequence, which should cause the remote system to erase the line currently
624being entered.
625.It Ic eof
626Sends the
627.Dv TELNET EOF
628(End Of File)
629sequence.
630.It Ic eor
631Sends the
632.Dv TELNET EOR
633(End of Record)
634sequence.
635.It Ic escape
636Sends the current
637.Nm telnet
638escape character (initially \*(Lq^\*(Rq).
639.It Ic ga
640Sends the
641.Dv TELNET GA
642(Go Ahead)
643sequence, which likely has no significance to the remote system.
644.It Ic getstatus
645If the remote side supports the
646.Dv TELNET STATUS
647command,
648.Ic getstatus
649will send the subnegotiation to request that the server send
650its current option status.
651.It Ic ip
652Sends the
653.Dv TELNET IP
654(Interrupt Process) sequence, which should cause the remote
655system to abort the currently running process.
656.It Ic nop
657Sends the
658.Dv TELNET NOP
659(No OPeration)
660sequence.
661.It Ic susp
662Sends the
663.Dv TELNET SUSP
664(SUSPend process)
665sequence.
666.It Ic synch
667Sends the
668.Dv TELNET SYNCH
669sequence.
670This sequence causes the remote system to discard all previously typed
671(but not yet read) input.
672This sequence is sent as
673.Tn TCP
674urgent
675data (and may not work if the remote system is a
676.Bx 4.2
677system -- if
678it doesn't work, a lower case \*(Lqr\*(Rq may be echoed on the terminal).
679.It Ic do Ar cmd
680.It Ic dont Ar cmd
681.It Ic will Ar cmd
682.It Ic wont Ar cmd
683Sends the
684.Dv TELNET DO
685.Ar cmd
686sequence.
687.Ar Cmd
688can be either a decimal number between 0 and 255,
689or a symbolic name for a specific
690.Dv TELNET
691command.
692.Ar Cmd
693can also be either
694.Ic help
695or
696.Ic ?\&
697to print out help information, including
698a list of known symbolic names.
699.It Ic ?\&
700Prints out help information for the
701.Ic send
702command.
703.El
704.It Ic set Ar argument value
705.It Ic unset Ar argument value
706The
707.Ic set
708command will set any one of a number of
709.Nm telnet
710variables to a specific value or to
711.Dv TRUE .
712The special value
713.Ic off
714turns off the function associated with
715the variable, this is equivalent to using the
716.Ic unset
717command.
718The
719.Ic unset
720command will disable or set to
721.Dv FALSE
722any of the specified functions.
723The values of variables may be interrogated with the
724.Ic display
725command.
726The variables which may be set or unset, but not toggled, are
727listed here.  In addition, any of the variables for the
728.Ic toggle
729command may be explicitly set or unset using
730the
731.Ic set
732and
733.Ic unset
734commands.
735.Bl -tag -width escape
736.It Ic ayt
737If
738.Tn TELNET
739is in localchars mode, or
740.Dv LINEMODE
741is enabled, and the status character is typed, a
742.Dv TELNET AYT
743sequence (see
744.Ic send ayt
745preceding) is sent to the
746remote host.  The initial value for the "Are You There"
747character is the terminal's status character.
748.It Ic echo
749This is the value (initially \*(Lq^E\*(Rq) which, when in
750\*(Lqline by line\*(Rq mode, toggles between doing local echoing
751of entered characters (for normal processing), and suppressing
752echoing of entered characters (for entering, say, a password).
753.It Ic eof
754If
755.Nm telnet
756is operating in
757.Dv LINEMODE
758or \*(Lqold line by line\*(Rq mode, entering this character
759as the first character on a line will cause this character to be
760sent to the remote system.
761The initial value of the eof character is taken to be the terminal's
762.Ic eof
763character.
764.It Ic erase
765If
766.Nm telnet
767is in
768.Ic localchars
769mode (see
770.Ic toggle
771.Ic localchars
772below),
773.Sy and
774if
775.Nm telnet
776is operating in \*(Lqcharacter at a time\*(Rq mode, then when this
777character is typed, a
778.Dv TELNET EC
779sequence (see
780.Ic send
781.Ic ec
782above)
783is sent to the remote system.
784The initial value for the erase character is taken to be
785the terminal's
786.Ic erase
787character.
788.It Ic escape
789This is the
790.Nm telnet
791escape character (initially \*(Lq^[\*(Rq) which causes entry
792into
793.Nm telnet
794command mode (when connected to a remote system).
795.It Ic flushoutput
796If
797.Nm telnet
798is in
799.Ic localchars
800mode (see
801.Ic toggle
802.Ic localchars
803below)
804and the
805.Ic flushoutput
806character is typed, a
807.Dv TELNET AO
808sequence (see
809.Ic send
810.Ic ao
811above)
812is sent to the remote host.
813The initial value for the flush character is taken to be
814the terminal's
815.Ic flush
816character.
817.It Ic forw1
818.It Ic forw2
819If
820.Tn TELNET
821is operating in
822.Dv LINEMODE ,
823these are the
824characters that, when typed, cause partial lines to be
825forwarded to the remote system.  The initial value for
826the forwarding characters are taken from the terminal's
827eol and eol2 characters.
828.It Ic interrupt
829If
830.Nm telnet
831is in
832.Ic localchars
833mode (see
834.Ic toggle
835.Ic localchars
836below)
837and the
838.Ic interrupt
839character is typed, a
840.Dv TELNET IP
841sequence (see
842.Ic send
843.Ic ip
844above)
845is sent to the remote host.
846The initial value for the interrupt character is taken to be
847the terminal's
848.Ic intr
849character.
850.It Ic kill
851If
852.Nm telnet
853is in
854.Ic localchars
855mode (see
856.Ic toggle
857.Ic localchars
858below),
859.Ic and
860if
861.Nm telnet
862is operating in \*(Lqcharacter at a time\*(Rq mode, then when this
863character is typed, a
864.Dv TELNET EL
865sequence (see
866.Ic send
867.Ic el
868above)
869is sent to the remote system.
870The initial value for the kill character is taken to be
871the terminal's
872.Ic kill
873character.
874.It Ic lnext
875If
876.Nm telnet
877is operating in
878.Dv LINEMODE
879or \*(Lqold line by line\*(Lq mode, then this character is taken to
880be the terminal's
881.Ic lnext
882character.
883The initial value for the lnext character is taken to be
884the terminal's
885.Ic lnext
886character.
887.It Ic quit
888If
889.Nm telnet
890is in
891.Ic localchars
892mode (see
893.Ic toggle
894.Ic localchars
895below)
896and the
897.Ic quit
898character is typed, a
899.Dv TELNET BRK
900sequence (see
901.Ic send
902.Ic brk
903above)
904is sent to the remote host.
905The initial value for the quit character is taken to be
906the terminal's
907.Ic quit
908character.
909.It Ic reprint
910If
911.Nm telnet
912is operating in
913.Dv LINEMODE
914or \*(Lqold line by line\*(Lq mode, then this character is taken to
915be the terminal's
916.Ic reprint
917character.
918The initial value for the reprint character is taken to be
919the terminal's
920.Ic reprint
921character.
922.It Ic rlogin
923This is the rlogin escape character.
924If set, the normal
925.Tn TELNET
926escape character is ignored unless it is
927preceded by this character at the beginning of a line.
928This character, at the beginning of a line followed by
929a "."  closes the connection; when followed by a ^Z it
930suspends the telnet command.  The initial state is to
931disable the rlogin escape character.
932.It Ic start
933If the
934.Dv TELNET TOGGLE-FLOW-CONTROL
935option has been enabled,
936then this character is taken to
937be the terminal's
938.Ic start
939character.
940The initial value for the kill character is taken to be
941the terminal's
942.Ic start
943character.
944.It Ic stop
945If the
946.Dv TELNET TOGGLE-FLOW-CONTROL
947option has been enabled,
948then this character is taken to
949be the terminal's
950.Ic stop
951character.
952The initial value for the kill character is taken to be
953the terminal's
954.Ic stop
955character.
956.It Ic susp
957If
958.Nm telnet
959is in
960.Ic localchars
961mode, or
962.Dv LINEMODE
963is enabled, and the
964.Ic suspend
965character is typed, a
966.Dv TELNET SUSP
967sequence (see
968.Ic send
969.Ic susp
970above)
971is sent to the remote host.
972The initial value for the suspend character is taken to be
973the terminal's
974.Ic suspend
975character.
976.It Ic tracefile
977This is the file to which the output, caused by
978.Ic netdata
979or
980.Ic option
981tracing being
982.Dv TRUE ,
983will be written.  If it is set to
984.Dq Fl ,
985then tracing information will be written to standard output (the default).
986.It Ic worderase
987If
988.Nm telnet
989is operating in
990.Dv LINEMODE
991or \*(Lqold line by line\*(Lq mode, then this character is taken to
992be the terminal's
993.Ic worderase
994character.
995The initial value for the worderase character is taken to be
996the terminal's
997.Ic worderase
998character.
999.It Ic ?\&
1000Displays the legal
1001.Ic set
1002.Pq Ic unset
1003commands.
1004.El
1005.It Ic slc Ar state
1006The
1007.Ic slc
1008command (Set Local Characters) is used to set
1009or change the state of the the special
1010characters when the
1011.Dv TELNET LINEMODE
1012option has
1013been enabled.  Special characters are characters that get
1014mapped to
1015.Tn TELNET
1016commands sequences (like
1017.Ic ip
1018or
1019.Ic quit  )
1020or line editing characters (like
1021.Ic erase
1022and
1023.Ic kill  ) .
1024By default, the local special characters are exported.
1025.Bl -tag -width Fl
1026.It Ic check
1027Verify the current settings for the current special characters.
1028The remote side is requested to send all the current special
1029character settings, and if there are any discrepancies with
1030the local side, the local side will switch to the remote value.
1031.It Ic export
1032Switch to the local defaults for the special characters.  The
1033local default characters are those of the local terminal at
1034the time when
1035.Nm telnet
1036was started.
1037.It Ic import
1038Switch to the remote defaults for the special characters.
1039The remote default characters are those of the remote system
1040at the time when the
1041.Tn TELNET
1042connection was established.
1043.It Ic ?\&
1044Prints out help information for the
1045.Ic slc
1046command.
1047.El
1048.It Ic status
1049Show the current status of
1050.Nm telnet  .
1051This includes the peer one is connected to, as well
1052as the current mode.
1053.It Ic toggle Ar arguments ...
1054Toggle (between
1055.Dv TRUE
1056and
1057.Dv FALSE )
1058various flags that control how
1059.Nm telnet
1060responds to events.
1061These flags may be set explicitly to
1062.Dv TRUE
1063or
1064.Dv FALSE
1065using the
1066.Ic set
1067and
1068.Ic unset
1069commands listed above.
1070More than one argument may be specified.
1071The state of these flags may be interrogated with the
1072.Ic display
1073command.
1074Valid arguments are:
1075.Bl -tag -width Ar
1076.It Ic authdebug
1077Turns on debugging information for the authentication code.
1078.It Ic autoflush
1079If
1080.Ic autoflush
1081and
1082.Ic localchars
1083are both
1084.Dv TRUE ,
1085then when the
1086.Ic ao  ,
1087or
1088.Ic quit
1089characters are recognized (and transformed into
1090.Tn TELNET
1091sequences; see
1092.Ic set
1093above for details),
1094.Nm telnet
1095refuses to display any data on the user's terminal
1096until the remote system acknowledges (via a
1097.Dv TELNET TIMING MARK
1098option)
1099that it has processed those
1100.Tn TELNET
1101sequences.
1102The initial value for this toggle is
1103.Dv TRUE
1104if the terminal user had not
1105done an "stty noflsh", otherwise
1106.Dv FALSE
1107(see
1108.Xr stty  1  ) .
1109.It Ic autodecrypt
1110When the
1111.Dv TELNET ENCRYPT
1112option is negotiated, by
1113default the actual encryption (decryption) of the data
1114stream does not start automatically.  The autoencrypt
1115(autodecrypt) command states that encryption of the
1116output (input) stream should be enabled as soon as
1117possible.
1118.Pp
1119Note:  Because of export controls, the
1120.Dv TELNET ENCRYPT
1121option is not supported outside the United States and Canada.
1122.It Ic autologin
1123If the remote side supports the
1124.Dv TELNET AUTHENTICATION
1125option
1126.Tn TELNET
1127attempts to use it to perform automatic authentication.  If the
1128.Dv AUTHENTICATION
1129option is not supported, the user's login
1130name are propagated through the
1131.Dv TELNET ENVIRON
1132option.
1133This command is the same as specifying
1134.Ar a
1135option on the
1136.Ic open
1137command.
1138.It Ic autosynch
1139If
1140.Ic autosynch
1141and
1142.Ic localchars
1143are both
1144.Dv TRUE ,
1145then when either the
1146.Ic intr
1147or
1148.Ic quit
1149characters is typed (see
1150.Ic set
1151above for descriptions of the
1152.Ic intr
1153and
1154.Ic quit
1155characters), the resulting
1156.Tn TELNET
1157sequence sent is followed by the
1158.Dv TELNET SYNCH
1159sequence.
1160This procedure
1161.Ic should
1162cause the remote system to begin throwing away all previously
1163typed input until both of the
1164.Tn TELNET
1165sequences have been read and acted upon.
1166The initial value of this toggle is
1167.Dv FALSE .
1168.It Ic binary
1169Enable or disable the
1170.Dv TELNET BINARY
1171option on both input and output.
1172.It Ic inbinary
1173Enable or disable the
1174.Dv TELNET BINARY
1175option on input.
1176.It Ic outbinary
1177Enable or disable the
1178.Dv TELNET BINARY
1179option on output.
1180.It Ic crlf
1181If this is
1182.Dv TRUE ,
1183then carriage returns will be sent as
1184.Li \*[Lt]CR\*[Gt]\*[Lt]LF\*[Gt] .
1185If this is
1186.Dv FALSE ,
1187then carriage returns will be send as
1188.Li \*[Lt]CR\*[Gt]\*[Lt]NUL\*[Gt] .
1189The initial value for this toggle is
1190.Dv FALSE .
1191.It Ic crmod
1192Toggle carriage return mode.
1193When this mode is enabled, most carriage return characters received from
1194the remote host will be mapped into a carriage return followed by
1195a line feed.
1196This mode does not affect those characters typed by the user, only
1197those received from the remote host.
1198This mode is not very useful unless the remote host
1199only sends carriage return, but never line feed.
1200The initial value for this toggle is
1201.Dv FALSE .
1202.It Ic debug
1203Toggles socket level debugging (useful only to the
1204.Ic super user  ) .
1205The initial value for this toggle is
1206.Dv FALSE .
1207.It Ic encdebug
1208Turns on debugging information for the encryption code.
1209.It Ic localchars
1210If this is
1211.Dv TRUE ,
1212then the
1213.Ic flush  ,
1214.Ic interrupt ,
1215.Ic quit  ,
1216.Ic erase ,
1217and
1218.Ic kill
1219characters (see
1220.Ic set
1221above) are recognized locally, and transformed into (hopefully) appropriate
1222.Tn TELNET
1223control sequences
1224(respectively
1225.Ic ao  ,
1226.Ic ip ,
1227.Ic brk  ,
1228.Ic ec ,
1229and
1230.Ic el  ;
1231see
1232.Ic send
1233above).
1234The initial value for this toggle is
1235.Dv TRUE
1236in \*(Lqold line by line\*(Rq mode,
1237and
1238.Dv FALSE
1239in \*(Lqcharacter at a time\*(Rq mode.
1240When the
1241.Dv LINEMODE
1242option is enabled, the value of
1243.Ic localchars
1244is ignored, and assumed to always be
1245.Dv TRUE .
1246If
1247.Dv LINEMODE
1248has ever been enabled, then
1249.Ic quit
1250is sent as
1251.Ic abort  ,
1252and
1253.Ic eof
1254and
1255.Ic suspend
1256are sent as
1257.Ic eof
1258and
1259.Ic susp ,
1260see
1261.Ic send
1262above).
1263.It Ic netdata
1264Toggles the display of all network data (in hexadecimal format).
1265The initial value for this toggle is
1266.Dv FALSE .
1267.It Ic options
1268Toggles the display of some internal
1269.Nm telnet
1270protocol processing (having to do with
1271.Tn TELNET
1272options).
1273The initial value for this toggle is
1274.Dv FALSE .
1275.It Ic prettydump
1276When the
1277.Ic netdata
1278toggle is enabled, if
1279.Ic prettydump
1280is enabled the output from the
1281.Ic netdata
1282command will be formatted in a more user readable format.
1283Spaces are put between each character in the output, and the
1284beginning of any
1285.Tn TELNET
1286escape sequence is preceded by a '*' to aid in locating them.
1287.It Ic skiprc
1288When the skiprc toggle is
1289.Dv TRUE ,
1290.Tn TELNET
1291skips the reading of the
1292.Pa \&.telnetrc
1293file in the users home
1294directory when connections are opened.  The initial
1295value for this toggle is
1296.Dv FALSE .
1297.It Ic termdata
1298Toggles the display of all terminal data (in hexadecimal format).
1299The initial value for this toggle is
1300.Dv FALSE .
1301.It Ic verbose_encrypt
1302When the
1303.Ic verbose_encrypt
1304toggle is
1305.Dv TRUE ,
1306.Tn TELNET
1307prints out a message each time encryption is enabled or
1308disabled.  The initial value for this toggle is
1309.Dv FALSE .
1310Note:  Because of export controls, data encryption
1311is not supported outside of the United States and Canada.
1312.It Ic \&?
1313Displays the legal
1314.Ic toggle
1315commands.
1316.El
1317.It Ic z
1318Suspend
1319.Nm telnet  .
1320This command only works when the user is using the
1321.Xr csh  1  .
1322.It Ic \&! Op Ar command
1323Execute a single command in a subshell on the local
1324system.  If
1325.Ic command
1326is omitted, then an interactive
1327subshell is invoked.
1328.It Ic ?\& Op Ar command
1329Get help.  With no arguments,
1330.Nm telnet
1331prints a help summary.
1332If a command is specified,
1333.Nm telnet
1334will print the help information for just that command.
1335.El
1336.Sh ENVIRONMENT
1337.Nm Telnet
1338uses at least the
1339.Ev HOME ,
1340.Ev SHELL ,
1341.Ev DISPLAY ,
1342and
1343.Ev TERM
1344environment variables.
1345Other environment variables may be propagated
1346to the other side via the
1347.Dv TELNET ENVIRON
1348option.
1349.Sh FILES
1350.Bl -tag -width ~/.telnetrc -compact
1351.It Pa ~/.telnetrc
1352user customized telnet startup values
1353.El
1354.Sh HISTORY
1355The
1356.Nm Telnet
1357command appeared in
1358.Bx 4.2 .
1359.Sh NOTES
1360.Pp
1361On some remote systems, echo has to be turned off manually when in
1362\*(Lqold line by line\*(Rq mode.
1363.Pp
1364In \*(Lqold line by line\*(Rq mode or
1365.Dv LINEMODE
1366the terminal's
1367.Ic eof
1368character is only recognized (and sent to the remote system)
1369when it is the first character on a line.
1370