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