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