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