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