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