xref: /original-bsd/usr.bin/telnet/telnet.1 (revision b7261a4b)
1.\" Copyright (c) 1983, 1990 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)telnet.1	6.9 (Berkeley) 06/11/90
7.\"
8.Dd
9.Dt TELNET 1
10.Os BSD 4.2
11.Sh NAME
12.Nm telnet
13.Nd user interface to the
14.Li TELNET
15protocol
16.Sh SYNOPSIS
17.Nm telnet
18.Op Fl d
19.Op Fl n Ar tracefile
20.Op Ar host Op Ar port
21.Sh DESCRIPTION
22The
23.Nm telnet
24command
25is used to communicate with another host using the
26.Li TELNET
27protocol.
28If
29.Nm telnet
30is invoked without the
31.Ar host
32argument, it enters command mode,
33indicated by its prompt
34.Pq Nm telnet\&> .
35In this mode, it accepts and executes the commands listed below.
36If it is invoked with arguments, it performs an
37.Ic open
38command with those arguments.
39.Pp
40Options:
41.Tw Fl
42.Tp Fl d
43Sets the initial value of the
44.Ic debug
45toggle to
46.Li TRUE
47.Tp Cx Fl n
48.Cx \&\ \&
49.Ar tracefile
50.Cx
51Opens
52.Ar tracefile
53for recording trace information.
54See the
55.Ic set tracefile
56command below.
57.Tp Ar host
58Indicates the official name, an alias, or the Internet address
59of a remote host.
60.Tp Ar port
61Indicates a port number (address of an application).  If a number is
62not specified, the default
63.Nm telnet
64port is used.
65.Tp
66.Pp
67Once a connection has been opened,
68.Nm telnet
69will attempt to enable the
70.Li TELNET LINEMODE
71option.
72If this fails, then
73.Nm telnet
74will revert to one of two input modes:
75either \*(Lqcharacter at a time\*(Rq
76or \*(Lqold line by line\*(Rq
77depending on what the remote system supports.
78.Pp
79When
80.Li LINEMODE
81is enabled, character processing is done on the
82local system, under the control of the remote system.  When input
83editing or character echoing is to be disabled, the remote system
84will relay that information.  The remote system will also relay
85changes to any special characters that happen on the remote
86system, so that they can take effect on the local system.
87.Pp
88In \*(Lqcharacter at a time\*(Rq mode, most
89text typed is immediately sent to the remote host for processing.
90.Pp
91In \*(Lqold line by line\*(Rq mode, all text is echoed locally,
92and (normally) only completed lines are sent to the remote host.
93The \*(Lqlocal echo character\*(Rq (initially \*(Lq^E\*(Rq) may be used
94to turn off and on the local echo
95(this would mostly be used to enter passwords
96without the password being echoed).
97.Pp
98If the
99.Li LINEMODE
100option is enabled, or if the
101.Ic localchars
102toggle is TRUE (the default for \*(Lqold line by line\*(Lq; see below),
103the user's
104.Ic quit  ,
105.Ic intr ,
106and
107.Ic flush
108characters are trapped locally, and sent as
109.Li TELNET
110protocol sequences to the remote side.
111If
112.Li LINEMODE
113has ever been enabled, then the user's
114.Ic susp
115and
116.Ic eof
117are also sent as
118.Li TELNET
119protocol sequences,
120and
121.Ic quit
122is sent as a
123.Li TELNET ABORT
124instead of
125.Li BREAK
126There are options (see
127.Ic toggle
128.Ic autoflush
129and
130.Ic toggle
131.Ic autosynch
132below)
133which cause this action to flush subsequent output to the terminal
134(until the remote host acknowledges the
135.Li TELNET
136sequence) and flush previous terminal input
137(in the case of
138.Ic quit
139and
140.Ic intr  ) .
141.Pp
142While connected to a remote host,
143.Nm telnet
144command mode may be entered by typing the
145.Nm telnet
146\*(Lqescape character\*(Rq (initially \*(Lq^
147\*(Rq).
148When in command mode, the normal terminal editing conventions are available.
149.Pp
150The following .Nm telnet
151commands are available.
152Only enough of each command to uniquely identify it need be typed
153(this is also true for arguments to the
154.Ic mode  ,
155.Ic set ,
156.Ic toggle  ,
157.Ic unset ,
158.Ic slc  ,
159and
160.Ic display
161commands).
162.Pp
163.Tw Ic
164.Tp Ic close
165Close a
166.Li TELNET
167session and return to command mode.
168.Tp Cx Ic display
169.Cx \&\ \&
170.Ar argument ...
171.Cx
172Displays all, or some, of the
173.Ic set
174and
175.Ic toggle
176values (see below).
177.Tp Cx Ic mode
178.Cx \&\ \&
179.Ar type
180.Cx
181.Ar Type
182is one of several options, depending on the state of the
183.Li TELNET
184session.
185The remote host is asked for permission to go into the requested mode.
186If the remote host is capable of entering that mode, the requested
187mode will be entered.
188.Tw Ar
189.Tp Ic character
190Disable the
191.Li TELNET LINEMODE
192option, or, if the remote side does not understand the
193.Li LINEMODE
194option, then enter \*(Lqcharacter at a time\*(Lq mode.
195.Tp Ic line
196Enable the
197.Li TELNET LINEMODE
198option, or, if the remote side does not understand the
199.Li LINEMODE
200option, then attempt to enter \*(Lqold-line-by-line\*(Lq mode.
201.Tp Cx Ic isig
202.Cx \&\ \&
203.Pq Ic \-isig
204.Cx
205Attempt to enable (disable) the
206.Li TRAPSIG
207mode of the
208.Li LINEMODE
209option.
210This requires that the
211.Li LINEMODE
212option be enabled.
213.Tp Cx Ic edit
214.Cx \&\ \&
215.Pq Ic \-edit
216.Cx
217Attempt to enable (disable) the
218.Li EDIT
219mode of the
220.Li LINEMODE
221option.
222This requires that the
223.Li LINEMODE
224option be enabled.
225.Tp Ic \&?
226Prints out help information for the
227.Ic mode
228command.
229.Tp
230.Tp Cx Ic open
231.Cx \&\ \&
232.Ar host
233.Cx \&\ \&
234.Cx [
235.Op Fl
236.Cx \&\ \&
237.Ar port
238.Cx ]
239.Cx
240Open a connection to the named host.
241If no port number
242is specified,
243.Nm telnet
244will attempt to contact a
245.Li TELNET
246server at the default port.
247The host specification may be either a host name (see
248.Xr hosts  5  )
249or an Internet address specified in the \*(Lqdot notation\*(Rq (see
250.Xr inet 3 ) .
251When connecting to a non-standard port,
252.Nm telnet
253omits any automatic initiation of
254.Li TELNET
255options.  When the port number is preceeded by a minus sign,
256the inital option negotiation is done.
257After establishing a connection, the file
258.Pa \&.telnetrc
259in the
260users home directory is opened.  Lines begining with a # are
261comment lines.  Blank lines are ignored.  Lines that begin
262without whitespace are the start of a machine entry.  The
263first thing on the line is the name of the machine that is
264being connected to.  The rest of the line, and successive
265lines that begin with whitespace are assumed to be
266.Nm telnet
267commands and are processed as if they had been typed
268in manually to the
269.Nm telnet
270command prompt.
271.Tp Ic quit
272Close any open
273.Li TELNET
274session and exit
275.Nm telnet  .
276An end of file (in command mode) will also close a session and exit.
277.Tp Cx Ic send
278.Cx \&\ \&
279.Ar arguments
280.Cx
281Sends one or more special character sequences to the remote host.
282The following are the arguments which may be specified
283(more than one argument may be specified at a time):
284.Pp
285.Tw Ds
286.Tp Ic abort
287Sends the
288.Li TELNET ABORT
289(ABORT processes)
290sequence.
291.Tp Ic ao
292Sends the
293.Li TELNET AO
294(Abort Output) sequence, which should cause the remote system to flush
295all output
296.Em from
297the remote system
298.Em to
299the user's terminal.
300.Tp Ic ayt
301Sends the
302.Li TELNET AYT
303(Are You There)
304sequence, to which the remote system may or may not choose to respond.
305.Tp Ic brk
306Sends the
307.Li TELNET BRK
308(Break) sequence, which may have significance to the remote
309system.
310.Tp Ic ec
311Sends the
312.Li TELNET EC
313(Erase Character)
314sequence, which should cause the remote system to erase the last character
315entered.
316.Tp Ic el
317Sends the
318.Li TELNET EL
319(Erase Line)
320sequence, which should cause the remote system to erase the line currently
321being entered.
322.Tp Ic eof
323Sends the
324.Li TELNET EOF
325(End Of File)
326sequence.
327.Tp Ic eor
328Sends the
329.Li TELNET EOR
330(End of Record)
331sequence.
332.Tp Ic escape
333Sends the current
334.Nm telnet
335escape character (initially \*(Lq^\*(Rq).
336.Tp Ic ga
337Sends the
338.Li TELNET GA
339(Go Ahead)
340sequence, which likely has no significance to the remote system.
341.Tp Ic getstatus
342If the remote side supports the
343.Li TELNET STATUS
344command,
345.Ic getstatus
346will send the subnegotiation to request that the server send
347its current option status.
348.Tp Ic ip
349Sends the
350.Li TELNET IP
351(Interrupt Process) sequence, which should cause the remote
352system to abort the currently running process.
353.Tp Ic nop
354Sends the
355.Li TELNET NOP
356(No OPeration)
357sequence.
358.Tp Ic susp
359Sends the
360.Li TELNET SUSP
361(SUSPend process)
362sequence.
363.Tp Ic synch
364Sends the
365.Li TELNET SYNCH
366sequence.
367This sequence causes the remote system to discard all previously typed
368(but not yet read) input.
369This sequence is sent as TCP urgent
370data (and may not work if the remote system is a 4.2 BSD system -- if
371it doesn't work, a lower case \*(Lqr\*(Rq may be echoed on the terminal).
372.Tp Ic \&?
373Prints out help information for the
374.Ic send
375command.
376.Tp
377.Tp Cx Ic set
378.Cx \&\ \&
379.Ar argument value
380.Cx
381.Tp Cx Ic unset
382.Cx \&\ \&
383.Ar argument value
384.Cx
385The
386.Ic set
387command will set any one of a number of
388.Nm telnet
389variables to a specific value or to TRUE.
390The special value
391.Ic off
392turns off the function associated with
393the variable, this is equivalent to using the
394.Ic unset
395command.
396The
397.Ic unset
398command will disable or set to FALSE any of the specified functions.
399The values of variables may be interrogated with the
400.Ic display
401command.
402The variables which may be set or unset, but not toggled, are
403listed here.  In addition, any of the variables for the
404.Ic toggle
405command may be explicitly set or unset using
406the
407.Ic set
408and
409.Ic unset
410commands.
411.Tw Fl
412.Tp Ic echo
413This is the value (initially \*(Lq^E\*(Rq) which, when in
414\*(Lqline by line\*(Rq mode, toggles between doing local echoing
415of entered characters (for normal processing), and suppressing
416echoing of entered characters (for entering, say, a password).
417.Tp Ic eof
418If
419.Nm telnet
420is operating in
421.Li LINEMODE
422or \*(Lqold line by line\*(Rq mode, entering this character
423as the first character on a line will cause this character to be
424sent to the remote system.
425The initial value of the eof character is taken to be the terminal's
426.Ic eof
427character.
428.Tp Ic erase
429If
430.Nm telnet
431is in
432.Ic localchars
433mode (see
434.Ic toggle
435.Ic localchars
436below),
437.Sy and
438if
439.Nm telnet
440is operating in \*(Lqcharacter at a time\*(Rq mode, then when this
441character is typed, a
442.Li TELNET EC
443sequence (see
444.Ic send
445.Ic ec
446above)
447is sent to the remote system.
448The initial value for the erase character is taken to be
449the terminal's
450.Ic erase
451character.
452.Tp Ic escape
453This is the
454.Nm telnet
455escape character (initially \*(Lq^[\*(Rq) which causes entry
456into
457.Nm telnet
458command mode (when connected to a remote system).
459.Tp Ic flushoutput
460If
461.Nm telnet
462is in
463.Ic localchars
464mode (see
465.Ic toggle
466.Ic localchars
467below)
468and the
469.Ic flushoutput
470character is typed, a
471.Li TELNET AO
472sequence (see
473.Ic send
474.Ic ao
475above)
476is sent to the remote host.
477The initial value for the flush character is taken to be
478the terminal's
479.Ic flush
480character.
481.Tp Ic interrupt
482If
483.Nm telnet
484is in
485.Ic localchars
486mode (see
487.Ic toggle
488.Ic localchars
489below)
490and the
491.Ic interrupt
492character is typed, a
493.Li TELNET IP
494sequence (see
495.Ic send
496.Ic ip
497above)
498is sent to the remote host.
499The initial value for the interrupt character is taken to be
500the terminal's
501.Ic intr
502character.
503.Tp Ic kill
504If
505.Nm telnet
506is in
507.Ic localchars
508mode (see
509.Ic toggle
510.Ic localchars
511below),
512.Ic and
513if
514.Nm telnet
515is operating in \*(Lqcharacter at a time\*(Rq mode, then when this
516character is typed, a
517.Li TELNET EL
518sequence (see
519.Ic send
520.Ic el
521above)
522is sent to the remote system.
523The initial value for the kill character is taken to be
524the terminal's
525.Ic kill
526character.
527.Tp Ic lnext
528If
529.Nm telnet
530is operating in
531.Li LINEMODE
532or \*(Lqold line by line\*(Lq mode, then this character is taken to
533be the terminal's
534.Ic lnext
535character.
536The initial value for the lnext character is taken to be
537the terminal's
538.Ic lnext
539character.
540.Tp Ic quit
541If
542.Nm telnet
543is in
544.Ic localchars
545mode (see
546.Ic toggle
547.Ic localchars
548below)
549and the
550.Ic quit
551character is typed, a
552.Li TELNET BRK
553sequence (see
554.Ic send
555.Ic brk
556above)
557is sent to the remote host.
558The initial value for the quit character is taken to be
559the terminal's
560.Ic quit
561character.
562.Tp Ic reprint
563If
564.Nm telnet
565is operating in
566.Li LINEMODE
567or \*(Lqold line by line\*(Lq mode, then this character is taken to
568be the terminal's
569.Ic reprint
570character.
571The initial value for the reprint character is taken to be
572the terminal's
573.Ic reprint
574character.
575.Tp Ic start
576If the
577.Li TELNET TOGGLE-FLOW-CONTROL
578option has been enabled,
579then this character is taken to
580be the terminal's
581.Ic start
582character.
583The initial value for the kill character is taken to be
584the terminal's
585.Ic start
586character.
587.Tp Ic stop
588If the
589.Li TELNET TOGGLE-FLOW-CONTROL
590option has been enabled,
591then this character is taken to
592be the terminal's
593.Ic stop
594character.
595The initial value for the kill character is taken to be
596the terminal's
597.Ic stop
598character.
599.Tp Ic susp
600If
601.Nm telnet
602is in
603.Ic localchars
604mode, or
605.Li LINEMODE
606is enabled, and the
607.Ic suspend
608character is typed, a
609.Li TELNET SUSP
610sequence (see
611.Ic send
612.Ic susp
613above)
614is sent to the remote host.
615The initial value for the suspend character is taken to be
616the terminal's
617.Ic suspend
618character.
619.Tp Ic tracefile
620Thi is the file to which the output, caused by
621.Ic netdata
622or
623.Ic option
624tracing being TRUE, will be written.  If it is set to
625.Dq Fl ,
626then tracing information will be written to standard output (the default).
627.Tp Ic worderase
628If
629.Nm telnet
630is operating in
631.Li LINEMODE
632or \*(Lqold line by line\*(Lq mode, then this character is taken to
633be the terminal's
634.Ic worderase
635character.
636The initial value for the worderase character is taken to be
637the terminal's
638.Ic worderase
639character.
640.Tp
641.Tp Cx Ic slc
642.Cx \&\ \&
643.Ar state
644.Cx
645The
646.Ic slc
647command (Set Local Characters) is used to set
648or change the state of the the special
649characters when the
650.Li TELNET LINEMODE
651option has
652been enabled.  Special characters are characters that get
653mapped to
654.Li TELNET
655commands sequences (like
656.Ic ip
657or
658.Ic quit  )
659or line editing characters (like
660.Ic erase
661and
662.Ic kill  ) .
663By default, the local special characters are exported.
664.Tw Fl
665.Tp Ic export
666Switch to the local defaults for the special characters.  The
667local default characters are those of the local terminal at
668the time when
669.Nm telnet
670was started.
671.Tp Ic import
672Switch to the remote defaults for the special characters.
673The remote default characters are those of the remote system
674at the time when the
675.Li TELNET
676connection was established.
677.Tp Ic check
678Verify the current settings for the current special characters.
679The remote side is requested to send all the current special
680character settings, and if there are any discrepencies with
681the local side, the local side will switch to the remote value.
682.Ic Ic \&?
683Prints out help information for the
684.Ic slc
685command.
686.Tp
687.Tp Ic \&?
688Displays the legal
689.Ic set
690.Pq Ic unset
691commands.
692.Tp Cx Ic toggle
693.Cx \&\ \&
694.Ar arguments ...
695.Cx
696Toggle (between
697TRUE
698and
699FALSE)
700various flags that control how
701.Nm telnet
702responds to events.
703These flags may be set explicitly to TRUE or FALSE
704using the
705.Ic set
706and
707.Ic unset
708commands listed above.
709More than one argument may be specified.
710The state of these flags may be interrogated with the
711.Ic display
712command.
713Valid arguments are:
714.Tw Ar
715.Tp Ic autoflush
716If
717.Ic autoflush
718and
719.Ic localchars
720are both
721TRUE,
722then when the
723.Ic ao  ,
724or
725.Ic quit
726characters are recognized (and transformed into
727.Li TELNET
728sequences; see
729.Ic set
730above for details),
731.Nm telnet
732refuses to display any data on the user's terminal
733until the remote system acknowledges (via a
734.Li TELNET TIMING MARK
735option)
736that it has processed those
737.Li TELNET
738sequences.
739The initial value for this toggle is TRUE if the terminal user had not
740done an "stty noflsh", otherwise FALSE (see
741.Xr stty  1  ) .
742.Tp Ic autosynch
743If
744.Ic autosynch
745and
746.Ic localchars
747are both
748TRUE,
749then when either the
750.Ic intr
751or
752.Ic quit
753characters is typed (see
754.Ic set
755above for descriptions of the
756.Ic intr
757and
758.Ic quit
759characters), the resulting
760.Li TELNET
761sequence sent is followed by the
762.Li TELNET SYNCH
763sequence.
764This procedure
765.Ic should
766cause the remote system to begin throwing away all previously
767typed input until both of the
768.Li TELNET
769sequences have been read and acted upon.
770The initial value of this toggle is FALSE.
771.Tp Ic binary
772Enable or disable the
773.Li TELNET BINARY
774option on both input and output.
775.Tp Ic inbinary
776Enable or disable the
777.Li TELNET BINARY
778option on input.
779.Tp Ic outbinary
780Enable or disable the
781.Li TELNET BINARY
782option on output.
783.Tp Ic crlf
784If this is TRUE, then carriage returns will be sent as <CR><LF>.
785If this is FALSE, then carriage returns will be send as <CR><NUL>.
786The initial value for this toggle is FALSE.
787.Tp Ic crmod
788Toggle carriage return mode.
789When this mode is enabled, most carriage return characters received from
790the remote host will be mapped into a carriage return followed by
791a line feed.
792This mode does not affect those characters typed by the user, only
793those received from the remote host.
794This mode is not very useful unless the remote host
795only sends carriage return, but never line feed.
796The initial value for this toggle is FALSE.
797.Tp Ic debug
798Toggles socket level debugging (useful only to the
799.Ic super user  ) .
800The initial value for this toggle is FALSE.
801.Tp Ic localchars
802If this is
803TRUE,
804then the
805.Ic flush  ,
806.Ic quit  ,
807and
808.Ic kill
809characters (see
810.Ic set
811above) are recognized locally, and transformed into (hopefully) appropriate
812.Li TELNET
813control sequences
814(respectively
815.Ic ao  ,
816.Ic brk  ,
817and
818.Ic el  ;
819see
820.Ic send
821above).
822The initial value for this toggle is TRUE in \*(Lqold line by line\*(Rq mode,
823and FALSE in \*(Lqcharacter at a time\*(Rq mode.
824When the
825.Li LINEMODE
826option is enabled, the value of
827.Ic localchars
828is ignored, and assumed to always be TRUE.
829If
830.Li LINEMODE
831has ever been enabled, then
832.Ic quit
833is sent as
834.Ic abort  ,
835and
836.Ic eof and
837.B suspend
838are sent as
839.Ic eof and
840see
841.Ic send
842above).
843.Tp Ic netdata
844Toggles the display of all network data (in hexadecimal format).
845The initial value for this toggle is FALSE.
846.Tp Ic options
847Toggles the display of some internal
848.Nm telnet
849protocol processing (having to do with
850.Li TELNET
851options).
852The initial value for this toggle is FALSE.
853.Tp Ic prettydump
854When the
855.Ic netdata
856toggle is enabled, if
857.Ic prettydump
858is enabled the output from the
859.Ic netdata
860command will be formated in a more user readable format.
861Spaces are put between each character in the output, and the
862begining of any
863.Li TELNET
864escape sequence is preceeded by a '*' to aid in locating them.
865.Tp Ic \&?
866Displays the legal
867.Ic toggle
868commands.
869.Tp
870.Tp Ic z
871Suspend
872.Nm telnet  .
873This command only works when the user is using the
874.Xr csh  1  .
875.Tp Cx Ic \&!
876.Cx \&\ \&
877.Op Ar command
878.Cx
879Execute a single command in a subshell on the local
880system.  If
881.Ic command
882is ommitted, then an interactive
883subshell is invoked.
884.Tp Ic status
885Show the current status of
886.Nm telnet  .
887This includes the peer one is connected to, as well
888as the current mode.
889.Tp Cx Ic \&?
890.Cx \&\ \&
891.Op Ar command
892.Cx
893Get help.  With no arguments,
894.Nm telnet
895prints a help summary.
896If a command is specified,
897.Nm telnet
898will print the help information for just that command.
899.Sh ENVIRONMENT
900.Nm Telnet
901uses the
902.Ev HOME ,
903.Ev SHELL
904and
905.Ev TERM
906environent variables.
907.Sh FILES
908.Dw ~/.telnetrc
909.Di L
910.Dp Pa ~/.telnetrc
911user customized telnet startup values
912.Dp
913.Sh HISTORY
914.Nm Telnet
915appeared in 4.2 BSD.
916.Sh NOTES
917.Pp
918On some remote systems, echo has to be turned off manually when in
919\*(Lqold line by line\*(Rq mode.
920.Pp
921In \*(Lqold line by line\*(Rq mode or
922.Li LINEMODE
923the terminal's
924.Ic eof
925character is only recognized (and sent to the remote system)
926when it is the first character on a line.
927