xref: /dragonfly/usr.bin/telnet/telnet.1 (revision f02303f9)
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.3 2006/02/17 19:39:11 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.Pp
339.Bl -tag -width "mode type"
340.It Ic auth Ar argument ...
341The auth command manipulates the information sent through the
342.Dv TELNET AUTHENTICATE
343option.  Valid arguments for the
344.Ic auth
345command are:
346.Bl -tag -width "disable type"
347.It Ic disable Ar type
348Disables the specified type of authentication.  To
349obtain a list of available types, use the
350.Ic auth disable ?\&
351command.
352.It Ic enable Ar type
353Enables the specified type of authentication.  To
354obtain a list of available types, use the
355.Ic auth enable ?\&
356command.
357.It Ic status
358Lists the current status of the various types of
359authentication.
360.El
361.It Ic close
362Close a
363.Tn TELNET
364session and return to command mode.
365.It Ic display Ar argument ...
366Displays all, or some, of the
367.Ic set
368and
369.Ic toggle
370values (see below).
371.It Ic encrypt Ar argument ...
372The encrypt command manipulates the information sent through the
373.Dv TELNET ENCRYPT
374option.
375.Pp
376Valid arguments for the
377.Ic encrypt
378command are:
379.Bl -tag -width Ar
380.It Ic disable Ar type Xo
381.Op Cm input | output
382.Xc
383Disables the specified type of encryption.  If you
384omit the input and output, both input and output
385are disabled.  To obtain a list of available
386types, use the
387.Ic encrypt disable ?\&
388command.
389.It Ic enable Ar type Xo
390.Op Cm input | output
391.Xc
392Enables the specified type of encryption.  If you
393omit input and output, both input and output are
394enabled.  To obtain a list of available types, use the
395.Ic encrypt enable ?\&
396command.
397.It Ic input
398This is the same as the
399.Ic encrypt start input
400command.
401.It Ic -input
402This is the same as the
403.Ic encrypt stop input
404command.
405.It Ic output
406This is the same as the
407.Ic encrypt start output
408command.
409.It Ic -output
410This is the same as the
411.Ic encrypt stop output
412command.
413.It Ic start Op Cm input | output
414Attempts to start encryption.  If you omit
415.Ic input
416and
417.Ic output ,
418both input and output are enabled.  To
419obtain a list of available types, use the
420.Ic encrypt enable ?\&
421command.
422.It Ic status
423Lists the current status of encryption.
424.It Ic stop Op Cm input | output
425Stops encryption.  If you omit input and output,
426encryption is on both input and output.
427.It Ic type Ar type
428Sets the default type of encryption to be used
429with later
430.Ic encrypt start
431or
432.Ic encrypt stop
433commands.
434.El
435.It Ic environ Ar arguments ...
436The
437.Ic environ
438command is used to manipulate the
439variables that may be sent through the
440.Dv TELNET ENVIRON
441option.
442The initial set of variables is taken from the users
443environment, with only the
444.Ev DISPLAY
445and
446.Ev PRINTER
447variables being exported by default.
448The
449.Ev USER
450variable is also exported if the
451.Fl a
452or
453.Fl l
454options are used.
455.Pp
456Valid arguments for the
457.Ic environ
458command are:
459.Bl -tag -width Fl
460.It Ic define Ar variable value
461Define the variable
462.Ar variable
463to have a value of
464.Ar value .
465Any variables defined by this command are automatically exported.
466The
467.Ar value
468may be enclosed in single or double quotes so
469that tabs and spaces may be included.
470.It Ic undefine Ar variable
471Remove
472.Ar variable
473from the list of environment variables.
474.It Ic export Ar variable
475Mark the variable
476.Ar variable
477to be exported to the remote side.
478.It Ic unexport Ar variable
479Mark the variable
480.Ar variable
481to not be exported unless
482explicitly asked for by the remote side.
483.It Ic list
484List the current set of environment variables.
485Those marked with a
486.Cm *
487will be sent automatically,
488other variables will only be sent if explicitly requested.
489.It Ic ?\&
490Prints out help information for the
491.Ic environ
492command.
493.El
494.It Ic logout
495Sends the
496.Dv TELNET LOGOUT
497option to the remote side.
498This command is similar to a
499.Ic close
500command; however, if the remote side does not support the
501.Dv LOGOUT
502option, nothing happens.
503If, however, the remote side does support the
504.Dv LOGOUT
505option, this command should cause the remote side to close the
506.Tn TELNET
507connection.
508If the remote side also supports the concept of
509suspending a user's session for later reattachment,
510the logout argument indicates that you
511should terminate the session immediately.
512.It Ic mode Ar type
513.Ar Type
514is one of several options, depending on the state of the
515.Tn TELNET
516session.
517The remote host is asked for permission to go into the requested mode.
518If the remote host is capable of entering that mode, the requested
519mode will be entered.
520.Bl -tag -width Ar
521.It Ic character
522Disable the
523.Dv TELNET LINEMODE
524option, or, if the remote side does not understand the
525.Dv LINEMODE
526option, then enter \*(Lqcharacter at a time\*(Rq mode.
527.It Ic line
528Enable the
529.Dv TELNET LINEMODE
530option, or, if the remote side does not understand the
531.Dv LINEMODE
532option, then attempt to enter \*(Lqold-line-by-line\*(Rq mode.
533.It Ic isig Pq Ic \-isig
534Attempt to enable (disable) the
535.Dv TRAPSIG
536mode of the
537.Dv LINEMODE
538option.
539This requires that the
540.Dv LINEMODE
541option be enabled.
542.It Ic edit Pq Ic \-edit
543Attempt to enable (disable) the
544.Dv EDIT
545mode of the
546.Dv LINEMODE
547option.
548This requires that the
549.Dv LINEMODE
550option be enabled.
551.It Ic softtabs Pq Ic \-softtabs
552Attempt to enable (disable) the
553.Dv SOFT_TAB
554mode of the
555.Dv LINEMODE
556option.
557This requires that the
558.Dv LINEMODE
559option be enabled.
560.It Ic litecho Pq Ic \-litecho
561Attempt to enable (disable) the
562.Dv LIT_ECHO
563mode of the
564.Dv LINEMODE
565option.
566This requires that the
567.Dv LINEMODE
568option be enabled.
569.It Ic ?\&
570Prints out help information for the
571.Ic mode
572command.
573.El
574.It Xo
575.Ic open Ar host
576.Op Fl l Ar user
577.Op Oo Fl Oc Ns Ar port
578.Xc
579Open a connection to the named host.
580If no port number
581is specified,
582.Nm
583will attempt to contact a
584.Tn TELNET
585server at the default port.
586The host specification may be either a host name (see
587.Xr hosts  5  ) ,
588an Internet address specified in the \*(Lqdot notation\*(Rq (see
589.Xr inet 3 ) ,
590or IPv6 host name or IPv6 coloned-hexadecimal address.
591The
592.Fl l
593option may be used to specify the user name
594to be passed to the remote system via the
595.Ev ENVIRON
596option.
597When connecting to a non-standard port,
598.Nm
599omits any automatic initiation of
600.Tn TELNET
601options.  When the port number is preceded by a minus sign,
602the initial option negotiation is done.
603After establishing a connection, the file
604.Pa \&.telnetrc
605in the
606users home directory is opened.  Lines beginning with a # are
607comment lines.  Blank lines are ignored.  Lines that begin
608without white space are the start of a machine entry.  The
609first thing on the line is the name of the machine that is
610being connected to.  The rest of the line, and successive
611lines that begin with white space are assumed to be
612.Nm
613commands and are processed as if they had been typed
614in manually to the
615.Nm
616command prompt.
617.It Ic quit
618Close any open
619.Tn TELNET
620session and exit
621.Nm .
622An end of file (in command mode) will also close a session and exit.
623.It Ic send Ar arguments
624Sends one or more special character sequences to the remote host.
625The following are the arguments which may be specified
626(more than one argument may be specified at a time):
627.Pp
628.Bl -tag -width escape
629.It Ic abort
630Sends the
631.Dv TELNET ABORT
632(Abort
633processes)
634sequence.
635.It Ic ao
636Sends the
637.Dv TELNET AO
638(Abort Output) sequence, which should cause the remote system to flush
639all output
640.Em from
641the remote system
642.Em to
643the user's terminal.
644.It Ic ayt
645Sends the
646.Dv TELNET AYT
647(Are You There)
648sequence, to which the remote system may or may not choose to respond.
649.It Ic brk
650Sends the
651.Dv TELNET BRK
652(Break) sequence, which may have significance to the remote
653system.
654.It Ic ec
655Sends the
656.Dv TELNET EC
657(Erase Character)
658sequence, which should cause the remote system to erase the last character
659entered.
660.It Ic el
661Sends the
662.Dv TELNET EL
663(Erase Line)
664sequence, which should cause the remote system to erase the line currently
665being entered.
666.It Ic eof
667Sends the
668.Dv TELNET EOF
669(End Of File)
670sequence.
671.It Ic eor
672Sends the
673.Dv TELNET EOR
674(End of Record)
675sequence.
676.It Ic escape
677Sends the current
678.Nm
679escape character (initially \*(Lq^\*(Rq).
680.It Ic ga
681Sends the
682.Dv TELNET GA
683(Go Ahead)
684sequence, which likely has no significance to the remote system.
685.It Ic getstatus
686If the remote side supports the
687.Dv TELNET STATUS
688command,
689.Ic getstatus
690will send the subnegotiation to request that the server send
691its current option status.
692.It Ic ip
693Sends the
694.Dv TELNET IP
695(Interrupt Process) sequence, which should cause the remote
696system to abort the currently running process.
697.It Ic nop
698Sends the
699.Dv TELNET NOP
700(No OPeration)
701sequence.
702.It Ic susp
703Sends the
704.Dv TELNET SUSP
705(SUSPend process)
706sequence.
707.It Ic synch
708Sends the
709.Dv TELNET SYNCH
710sequence.
711This sequence causes the remote system to discard all previously typed
712(but not yet read) input.
713This sequence is sent as
714.Tn TCP
715urgent
716data (and may not work if the remote system is a
717.Bx 4.2
718system -- if
719it doesn't work, a lower case \*(Lqr\*(Rq may be echoed on the terminal).
720.It Ic do Ar cmd
721.It Ic dont Ar cmd
722.It Ic will Ar cmd
723.It Ic wont Ar cmd
724Sends the
725.Dv TELNET DO
726.Ar cmd
727sequence.
728.Ar Cmd
729can be either a decimal number between 0 and 255,
730or a symbolic name for a specific
731.Dv TELNET
732command.
733.Ar Cmd
734can also be either
735.Ic help
736or
737.Ic ?\&
738to print out help information, including
739a list of known symbolic names.
740.It Ic ?\&
741Prints out help information for the
742.Ic send
743command.
744.El
745.It Ic set Ar argument value
746.It Ic unset Ar argument value
747The
748.Ic set
749command will set any one of a number of
750.Nm
751variables to a specific value or to
752.Dv TRUE .
753The special value
754.Ic off
755turns off the function associated with
756the variable, this is equivalent to using the
757.Ic unset
758command.
759The
760.Ic unset
761command will disable or set to
762.Dv FALSE
763any of the specified functions.
764The values of variables may be interrogated with the
765.Ic display
766command.
767The variables which may be set or unset, but not toggled, are
768listed here.  In addition, any of the variables for the
769.Ic toggle
770command may be explicitly set or unset using
771the
772.Ic set
773and
774.Ic unset
775commands.
776.Bl -tag -width escape
777.It Ic ayt
778If
779.Tn TELNET
780is in localchars mode, or
781.Dv LINEMODE
782is enabled, and the status character is typed, a
783.Dv TELNET AYT
784sequence (see
785.Ic send ayt
786preceding) is sent to the
787remote host.  The initial value for the \*(LqAre You There\*(Rq
788character is the terminal's status character.
789.It Ic echo
790This is the value (initially \*(Lq^E\*(Rq) which, when in
791\*(Lqline by line\*(Rq mode, toggles between doing local echoing
792of entered characters (for normal processing), and suppressing
793echoing of entered characters (for entering, say, a password).
794.It Ic eof
795If
796.Nm
797is operating in
798.Dv LINEMODE
799or \*(Lqold line by line\*(Rq mode, entering this character
800as the first character on a line will cause this character to be
801sent to the remote system.
802The initial value of the eof character is taken to be the terminal's
803.Ic eof
804character.
805.It Ic erase
806If
807.Nm
808is in
809.Ic localchars
810mode (see
811.Ic toggle
812.Ic localchars
813below),
814.Sy and
815if
816.Nm
817is operating in \*(Lqcharacter at a time\*(Rq mode, then when this
818character is typed, a
819.Dv TELNET EC
820sequence (see
821.Ic send
822.Ic ec
823above)
824is sent to the remote system.
825The initial value for the erase character is taken to be
826the terminal's
827.Ic erase
828character.
829.It Ic escape
830This is the
831.Nm
832escape character (initially \*(Lq^[\*(Rq) which causes entry
833into
834.Nm
835command mode (when connected to a remote system).
836.It Ic flushoutput
837If
838.Nm
839is in
840.Ic localchars
841mode (see
842.Ic toggle
843.Ic localchars
844below)
845and the
846.Ic flushoutput
847character is typed, a
848.Dv TELNET AO
849sequence (see
850.Ic send
851.Ic ao
852above)
853is sent to the remote host.
854The initial value for the flush character is taken to be
855the terminal's
856.Ic flush
857character.
858.It Ic forw1
859.It Ic forw2
860If
861.Nm
862is operating in
863.Dv LINEMODE ,
864these are the
865characters that, when typed, cause partial lines to be
866forwarded to the remote system.  The initial value for
867the forwarding characters are taken from the terminal's
868eol and eol2 characters.
869.It Ic interrupt
870If
871.Nm
872is in
873.Ic localchars
874mode (see
875.Ic toggle
876.Ic localchars
877below)
878and the
879.Ic interrupt
880character is typed, a
881.Dv TELNET IP
882sequence (see
883.Ic send
884.Ic ip
885above)
886is sent to the remote host.
887The initial value for the interrupt character is taken to be
888the terminal's
889.Ic intr
890character.
891.It Ic kill
892If
893.Nm
894is in
895.Ic localchars
896mode (see
897.Ic toggle
898.Ic localchars
899below),
900.Ic and
901if
902.Nm
903is operating in \*(Lqcharacter at a time\*(Rq mode, then when this
904character is typed, a
905.Dv TELNET EL
906sequence (see
907.Ic send
908.Ic el
909above)
910is sent to the remote system.
911The initial value for the kill character is taken to be
912the terminal's
913.Ic kill
914character.
915.It Ic lnext
916If
917.Nm
918is operating in
919.Dv LINEMODE
920or \*(Lqold line by line\*(Rq mode, then this character is taken to
921be the terminal's
922.Ic lnext
923character.
924The initial value for the lnext character is taken to be
925the terminal's
926.Ic lnext
927character.
928.It Ic quit
929If
930.Nm
931is in
932.Ic localchars
933mode (see
934.Ic toggle
935.Ic localchars
936below)
937and the
938.Ic quit
939character is typed, a
940.Dv TELNET BRK
941sequence (see
942.Ic send
943.Ic brk
944above)
945is sent to the remote host.
946The initial value for the quit character is taken to be
947the terminal's
948.Ic quit
949character.
950.It Ic reprint
951If
952.Nm
953is operating in
954.Dv LINEMODE
955or \*(Lqold line by line\*(Rq mode, then this character is taken to
956be the terminal's
957.Ic reprint
958character.
959The initial value for the reprint character is taken to be
960the terminal's
961.Ic reprint
962character.
963.It Ic rlogin
964This is the rlogin escape character.
965If set, the normal
966.Nm
967escape character is ignored unless it is
968preceded by this character at the beginning of a line.
969This character, at the beginning of a line followed by
970a "."  closes the connection; when followed by a ^Z it
971suspends the
972.Nm
973command.  The initial state is to
974disable the
975.Nm rlogin
976escape character.
977.It Ic start
978If the
979.Dv TELNET TOGGLE-FLOW-CONTROL
980option has been enabled,
981then this character is taken to
982be the terminal's
983.Ic start
984character.
985The initial value for the start character is taken to be
986the terminal's
987.Ic start
988character.
989.It Ic stop
990If the
991.Dv TELNET TOGGLE-FLOW-CONTROL
992option has been enabled,
993then this character is taken to
994be the terminal's
995.Ic stop
996character.
997The initial value for the stop character is taken to be
998the terminal's
999.Ic stop
1000character.
1001.It Ic susp
1002If
1003.Nm
1004is in
1005.Ic localchars
1006mode, or
1007.Dv LINEMODE
1008is enabled, and the
1009.Ic suspend
1010character is typed, a
1011.Dv TELNET SUSP
1012sequence (see
1013.Ic send
1014.Ic susp
1015above)
1016is sent to the remote host.
1017The initial value for the suspend character is taken to be
1018the terminal's
1019.Ic suspend
1020character.
1021.It Ic tracefile
1022This is the file to which the output, caused by
1023.Ic netdata
1024or
1025.Ic option
1026tracing being
1027.Dv TRUE ,
1028will be written.  If it is set to
1029.Dq Fl ,
1030then tracing information will be written to standard output (the default).
1031.It Ic worderase
1032If
1033.Nm
1034is operating in
1035.Dv LINEMODE
1036or \*(Lqold line by line\*(Rq mode, then this character is taken to
1037be the terminal's
1038.Ic worderase
1039character.
1040The initial value for the worderase character is taken to be
1041the terminal's
1042.Ic worderase
1043character.
1044.It Ic ?\&
1045Displays the legal
1046.Ic set
1047.Pq Ic unset
1048commands.
1049.El
1050.It Ic skey Ar sequence challenge
1051The
1052.Ic skey
1053command computes a response to the S/Key challenge.
1054.It Ic slc Ar state
1055The
1056.Ic slc
1057command (Set Local Characters) is used to set
1058or change the state of the special
1059characters when the
1060.Dv TELNET LINEMODE
1061option has
1062been enabled.  Special characters are characters that get
1063mapped to
1064.Tn TELNET
1065commands sequences (like
1066.Ic ip
1067or
1068.Ic quit  )
1069or line editing characters (like
1070.Ic erase
1071and
1072.Ic kill  ) .
1073By default, the local special characters are exported.
1074.Bl -tag -width Fl
1075.It Ic check
1076Verify the current settings for the current special characters.
1077The remote side is requested to send all the current special
1078character settings, and if there are any discrepancies with
1079the local side, the local side will switch to the remote value.
1080.It Ic export
1081Switch to the local defaults for the special characters.  The
1082local default characters are those of the local terminal at
1083the time when
1084.Nm
1085was started.
1086.It Ic import
1087Switch to the remote defaults for the special characters.
1088The remote default characters are those of the remote system
1089at the time when the
1090.Tn TELNET
1091connection was established.
1092.It Ic ?\&
1093Prints out help information for the
1094.Ic slc
1095command.
1096.El
1097.It Ic status
1098Show the current status of
1099.Nm .
1100This includes the peer one is connected to, as well
1101as the current mode.
1102.It Ic toggle Ar arguments ...
1103Toggle (between
1104.Dv TRUE
1105and
1106.Dv FALSE )
1107various flags that control how
1108.Nm
1109responds to events.
1110These flags may be set explicitly to
1111.Dv TRUE
1112or
1113.Dv FALSE
1114using the
1115.Ic set
1116and
1117.Ic unset
1118commands listed above.
1119More than one argument may be specified.
1120The state of these flags may be interrogated with the
1121.Ic display
1122command.
1123Valid arguments are:
1124.Bl -tag -width Ar
1125.It Ic authdebug
1126Turns on debugging information for the authentication code.
1127.It Ic autoflush
1128If
1129.Ic autoflush
1130and
1131.Ic localchars
1132are both
1133.Dv TRUE ,
1134then when the
1135.Ic ao  ,
1136or
1137.Ic quit
1138characters are recognized (and transformed into
1139.Tn TELNET
1140sequences; see
1141.Ic set
1142above for details),
1143.Nm
1144refuses to display any data on the user's terminal
1145until the remote system acknowledges (via a
1146.Dv TELNET TIMING MARK
1147option)
1148that it has processed those
1149.Tn TELNET
1150sequences.
1151The initial value for this toggle is
1152.Dv TRUE
1153if the terminal user had not
1154done an "stty noflsh", otherwise
1155.Dv FALSE
1156(see
1157.Xr stty  1  ) .
1158.It Ic autodecrypt
1159When the
1160.Dv TELNET ENCRYPT
1161option is negotiated, by
1162default the actual encryption (decryption) of the data
1163stream does not start automatically.  The autoencrypt
1164(autodecrypt) command states that encryption of the
1165output (input) stream should be enabled as soon as
1166possible.
1167.It Ic autologin
1168If the remote side supports the
1169.Dv TELNET AUTHENTICATION
1170option
1171.Nm
1172attempts to use it to perform automatic authentication.  If the
1173.Dv AUTHENTICATION
1174option is not supported, the user's login
1175name are propagated through the
1176.Dv TELNET ENVIRON
1177option.
1178This command is the same as specifying
1179.Fl a
1180option on the
1181.Ic open
1182command.
1183.It Ic autosynch
1184If
1185.Ic autosynch
1186and
1187.Ic localchars
1188are both
1189.Dv TRUE ,
1190then when either the
1191.Ic intr
1192or
1193.Ic quit
1194characters is typed (see
1195.Ic set
1196above for descriptions of the
1197.Ic intr
1198and
1199.Ic quit
1200characters), the resulting
1201.Tn TELNET
1202sequence sent is followed by the
1203.Dv TELNET SYNCH
1204sequence.
1205This procedure
1206.Ic should
1207cause the remote system to begin throwing away all previously
1208typed input until both of the
1209.Tn TELNET
1210sequences have been read and acted upon.
1211The initial value of this toggle is
1212.Dv FALSE .
1213.It Ic binary
1214Enable or disable the
1215.Dv TELNET BINARY
1216option on both input and output.
1217.It Ic inbinary
1218Enable or disable the
1219.Dv TELNET BINARY
1220option on input.
1221.It Ic outbinary
1222Enable or disable the
1223.Dv TELNET BINARY
1224option on output.
1225.It Ic crlf
1226If this is
1227.Dv TRUE ,
1228then carriage returns will be sent as
1229.Li <CR><LF> .
1230If this is
1231.Dv FALSE ,
1232then carriage returns will be send as
1233.Li <CR><NUL> .
1234The initial value for this toggle is
1235.Dv FALSE .
1236.It Ic crmod
1237Toggle carriage return mode.
1238When this mode is enabled, most carriage return characters received from
1239the remote host will be mapped into a carriage return followed by
1240a line feed.
1241This mode does not affect those characters typed by the user, only
1242those received from the remote host.
1243This mode is not very useful unless the remote host
1244only sends carriage return, but never line feed.
1245The initial value for this toggle is
1246.Dv FALSE .
1247.It Ic debug
1248Toggles socket level debugging (useful only to the
1249.Ic super user  ) .
1250The initial value for this toggle is
1251.Dv FALSE .
1252.It Ic encdebug
1253Turns on debugging information for the encryption code.
1254.It Ic localchars
1255If this is
1256.Dv TRUE ,
1257then the
1258.Ic flush  ,
1259.Ic interrupt ,
1260.Ic quit  ,
1261.Ic erase ,
1262and
1263.Ic kill
1264characters (see
1265.Ic set
1266above) are recognized locally, and transformed into (hopefully) appropriate
1267.Tn TELNET
1268control sequences
1269(respectively
1270.Ic ao  ,
1271.Ic ip ,
1272.Ic brk  ,
1273.Ic ec ,
1274and
1275.Ic el  ;
1276see
1277.Ic send
1278above).
1279The initial value for this toggle is
1280.Dv TRUE
1281in \*(Lqold line by line\*(Rq mode,
1282and
1283.Dv FALSE
1284in \*(Lqcharacter at a time\*(Rq mode.
1285When the
1286.Dv LINEMODE
1287option is enabled, the value of
1288.Ic localchars
1289is ignored, and assumed to always be
1290.Dv TRUE .
1291If
1292.Dv LINEMODE
1293has ever been enabled, then
1294.Ic quit
1295is sent as
1296.Ic abort  ,
1297and
1298.Ic eof
1299and
1300.Ic suspend
1301are sent as
1302.Ic eof
1303and
1304.Ic susp
1305(see
1306.Ic send
1307above).
1308.It Ic netdata
1309Toggles the display of all network data (in hexadecimal format).
1310The initial value for this toggle is
1311.Dv FALSE .
1312.It Ic options
1313Toggles the display of some internal
1314.Nm
1315protocol processing (having to do with
1316.Tn TELNET
1317options).
1318The initial value for this toggle is
1319.Dv FALSE .
1320.It Ic prettydump
1321When the
1322.Ic netdata
1323toggle is enabled, if
1324.Ic prettydump
1325is enabled the output from the
1326.Ic netdata
1327command will be formatted in a more user readable format.
1328Spaces are put between each character in the output, and the
1329beginning of any
1330.Nm
1331escape sequence is preceded by a '*' to aid in locating them.
1332.It Ic skiprc
1333When the skiprc toggle is
1334.Dv TRUE ,
1335.Nm
1336skips the reading of the
1337.Pa \&.telnetrc
1338file in the users home
1339directory when connections are opened.  The initial
1340value for this toggle is
1341.Dv FALSE .
1342.It Ic termdata
1343Toggles the display of all terminal data (in hexadecimal format).
1344The initial value for this toggle is
1345.Dv FALSE .
1346.It Ic verbose_encrypt
1347When the
1348.Ic verbose_encrypt
1349toggle is
1350.Dv TRUE ,
1351.Nm
1352prints out a message each time encryption is enabled or
1353disabled.  The initial value for this toggle is
1354.Dv FALSE .
1355.It Ic ?\&
1356Displays the legal
1357.Ic toggle
1358commands.
1359.El
1360.It Ic z
1361Suspend
1362.Nm .
1363This command only works when the user is using the
1364.Xr csh  1  .
1365.It Ic \&! Op Ar command
1366Execute a single command in a subshell on the local
1367system.  If
1368.Ar command
1369is omitted, then an interactive
1370subshell is invoked.
1371.It Ic ?\& Op Ar command
1372Get help.  With no arguments,
1373.Nm
1374prints a help summary.
1375If
1376.Ar command
1377is specified,
1378.Nm
1379will print the help information for just that command.
1380.El
1381.Sh ENVIRONMENT
1382The
1383.Nm
1384utility uses at least the
1385.Ev HOME ,
1386.Ev SHELL ,
1387.Ev DISPLAY ,
1388and
1389.Ev TERM
1390environment variables.
1391Other environment variables may be propagated
1392to the other side via the
1393.Dv TELNET ENVIRON
1394option.
1395.Sh FILES
1396.Bl -tag -width ~/.telnetrc -compact
1397.It Pa ~/.telnetrc
1398user customized telnet startup values
1399.El
1400.Sh SEE ALSO
1401.Xr rlogin 1 ,
1402.Xr rsh 1 ,
1403.Xr hosts 5 ,
1404.Xr nologin 5 ,
1405.Xr telnetd 8
1406.Sh HISTORY
1407The
1408.Nm
1409command appeared in
1410.Bx 4.2 .
1411.Pp
1412IPv6 support was added by WIDE/KAME project.
1413.Sh NOTES
1414On some remote systems, echo has to be turned off manually when in
1415\*(Lqold line by line\*(Rq mode.
1416.Pp
1417In \*(Lqold line by line\*(Rq mode or
1418.Dv LINEMODE
1419the terminal's
1420.Ic eof
1421character is only recognized (and sent to the remote system)
1422when it is the first character on a line.
1423