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