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