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