telnet—User interface to the Telnet protocol
telnet [-d] [-a] [-n tracefile] [-e escapechar] [[-l user] host [port]]
The telnet command is used to communicate with another host using the Telnet protocol. If telnet is invoked without the host argument, it enters command mode, indicated by its prompt telnet>. In this mode, it accepts and executes the commands listed below. If it is invoked with arguments, it performs an open command with those arguments.
|-d||Sets the initial value of the debug toggle to True.|
|-a||Attempt automatic login. Currently, this sends the username via the USER variable of the ENVIRON option if supported by the remote system. The name used is that of the current user as returned by getlogin 2 if it agrees with the current user ID; otherwise, it is the name associated with the user ID.|
|-n||tracefile Opens tracefile for recording trace information. See the set tracefile command in the “Commands” section.|
|-l||user When connecting to the remote system, if the remote system understands the ENVIRON option, then user will be sent to the remote system as the value for the variable USER. This option implies the -a option. This option may also be used with the open command.|
|-e||escape char Sets the initial telnet escape character to escape char. If escape char is omitted, then there will be no escape character.|
|host||Indicates the official name, an alias, or the Internet address of a remote host.|
|port||Indicates a port number (address of an application). If a number is not specified, the default telnet port is used.|
Once a connection has been opened, telnet will attempt to enable the TELNETLINEMODE option. If this fails, then telnet will revert to one of two input modes—either character-at-a-time or old line-by-line, depending on what the remote system supports.
When LINEMODE is enabled, character processing is done on the local system, under the control of the remote system. When input editing or character echoing is to be disabled, the remote system will relay that information. The remote system will also relay changes to any special characters that happen on the remote system, so that they can take effect on the local system. In character-at-a-time mode, most text typed is immediately sent to the remote host for processing.
In old line-by-line mode, all text is echoed locally, and (normally) only completed lines are sent to the remote host. The local echo character (initially ˆE) may be used to turn off and on the local echo. (This would mostly be used to enter passwords without the password being echoed.)
If the LINEMODE option is enabled, or if the localchars toggle is True (the default for old line-by-line), the user’s quit, intr, and flush characters are trapped locally, and sent as Telnet protocol sequences to the remote side. If LINEMODE has ever been enabled, then the user’s susp and eof are also sent as Telnet protocol sequences, and quit is sent as a TELNET ABORT instead of BREAK There are options (see toggle autoflush and toggle autosynch in the following list) that cause this action to flush subsequent output terminal (until the remote host acknowledges the telnet sequence) and flush previous terminal input (in the case of quit and intr).