{
    "content": [
        {
            "type": "text",
            "text": "# telnet(1) (man)\n\n## TLDR\n\n> Connect to a specified port of a host using the telnet protocol.\n\n- Telnet to the default port of a host:\n  `telnet {{host}}`\n- Telnet to a specific port of a host:\n  `telnet {{ip_address}} {{port}}`\n- [Interactive] Exit a telnet session:\n  `quit`\n- Emit the default escape character combination for terminating the session:\n  `<Ctrl ]>`\n- Start `telnet` with \"x\" as the session termination character:\n  `telnet {{-e|--escape}} {{x}} {{ip_address}} {{port}}`\n- Telnet to Star Wars animation:\n  `telnet {{towel.blinkenlights.nl}}`\n\n*Source: tldr-pages*\n\n---\n\n**Summary:** telnet — user interface to the TELNET protocol\n\n**Synopsis:** telnet [-468ELadr] [-S tos] [-b address] [-e escapechar] [-l user] [-n tracefile] [host [port]]\n\n## Flags\n\n| Flag | Long | Arg | Description |\n|------|------|-----|-------------|\n| -4 | — | — |  |\n| -6 | — | — |  |\n| -8 | — | — | for both input and output. By default telnet is not 8-bit clean. |\n| -E | — | — | character''. |\n| -L | — | — | gotiated on just output. |\n| -a | — | — | the NEW-ENVIRON option if supported by the remote system. The username is retrieved via getlogin(3). |\n| -b | — | — | Use bind(2) on the local socket to bind it to a specific local address. |\n| -d | — | — |  |\n| -r | — | — | interpretation of the escape character is changed: an escape character followed by a dot causes telnet to disconnect fro |\n| -S | — | — |  |\n| -e | — | — | Sets the escape character to escapechar. If no character is supplied, no escape charac‐ ter will be used. Entering the e |\n| -l | — | — | Specify user as the user to log in as on the remote system. This is accomplished by sending the specified name as the US |\n| -n | — | — | Opens tracefile for recording trace information. See the set tracefile command below. host Specifies a host to contact o |\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (2 lines)\n- **DESCRIPTION** (7 lines) — 13 subsections\n  - -4 (1 lines)\n  - -6 (1 lines)\n  - -8 (2 lines)\n  - -E (2 lines)\n  - -L (2 lines)\n  - -a (3 lines)\n  - -b (2 lines)\n  - -d (1 lines)\n  - -r (5 lines)\n  - -S (1 lines)\n  - -e (4 lines)\n  - -l (5 lines)\n  - -n (493 lines)\n- **ENVIRONMENT** (3 lines)\n- **FILES** (3 lines)\n- **HISTORY** (2 lines)\n- **NOTES** (5 lines)\n- **BUGS** (2 lines)\n- **Linux NetKit (0.17)             August 15, 1999            Linux NetKit (0.17)** (1 lines)\n\n## Full Content\n\n### NAME\n\ntelnet — user interface to the TELNET protocol\n\n### SYNOPSIS\n\ntelnet [-468ELadr] [-S tos] [-b address] [-e escapechar] [-l user] [-n tracefile] [host [port]]\n\n### DESCRIPTION\n\nThe telnet command is used for interactive communication with another host using the TELNET\nprotocol. It begins in command mode, where it prints a telnet prompt (\"telnet> \"). If telnet is\ninvoked with a host argument, it performs an open command implicitly; see the description be‐\nlow.\n\nOptions:\n\n#### -4\n\n#### -6\n\n#### -8\n\nfor both input and output. By default telnet is not 8-bit clean.\n\n#### -E\n\ncharacter''.\n\n#### -L\n\ngotiated on just output.\n\n#### -a\n\nthe NEW-ENVIRON option if supported by the remote system. The username is retrieved via\ngetlogin(3).\n\n#### -b\n\nUse bind(2) on the local socket to bind it to a specific local address.\n\n#### -d\n\n#### -r\n\ninterpretation of the escape character is changed: an escape character followed by a\ndot causes telnet to disconnect from the remote host. A ^Z instead of a dot suspends\ntelnet, and a ^] (the default telnet escape character) generates a normal telnet\nprompt. These codes are accepted only at the beginning of a line.\n\n#### -S\n\n#### -e\n\nSets the escape character to escapechar. If no character is supplied, no escape charac‐\nter will be used.  Entering the escape character while connected causes telnet to drop\nto command mode.\n\n#### -l\n\nSpecify user as the user to log in as on the remote system. This is accomplished by\nsending the specified name as the USER environment variable, so it requires that the\nremote system support the TELNET NEW-ENVIRON option. This option implies the -a option,\nand may also be used with the open command.\n\n#### -n\n\nOpens tracefile for recording trace information.  See the set tracefile command below.\n\nhost    Specifies a host to contact over the network.\n\nport    Specifies a port number or service name to contact. If not specified, the telnet port\n(23) is used.\n\nProtocol:\n\nOnce a connection has been opened, telnet will attempt to enable the TELNET LINEMODE option.\nIf this fails, then telnet will revert to one of two input modes: either “character at a time”\nor “old line by line” depending on what the remote system supports.\n\nWhen LINEMODE is enabled, character processing is done on the local system, under the control\nof the remote system.  When input editing or character echoing is to be disabled, the remote\nsystem will relay that information.  The remote system will also relay changes to any special\ncharacters that happen on the remote system, so that they can take effect on the local system.\n\nIn “character at a time” mode, most text typed is immediately sent to the remote host for pro‐\ncessing.\n\nIn “old line by line” mode, all text is echoed locally, and (normally) only completed lines are\nsent to the remote host.  The “local echo character” (initially “^E”) may be used to turn off\nand on the local echo (this would mostly be used to enter passwords without the password being\nechoed).\n\nIf the LINEMODE option is enabled, or if the localchars toggle is TRUE (the default for “old\nline by line“; see below), the user's quit, intr, and flush characters are trapped locally, and\nsent as TELNET protocol sequences to the remote side.  If LINEMODE has ever been enabled, then\nthe user's susp and eof are also sent as TELNET protocol sequences, and quit is sent as a\nTELNET ABORT instead of BREAK There are options (see toggle autoflush and toggle autosynch be‐\nlow) which cause this action to flush subsequent output to the terminal (until the remote host\nacknowledges the TELNET sequence) and flush previous terminal input (in the case of quit and\nintr).\n\nCommands:\n\nThe following telnet commands are available. Unique prefixes are understood as abbreviations.\n\nauth argument ...\nThe auth command controls the TELNET AUTHENTICATE protocol option.  If telnet was\ncompiled without authentication, the auth command will not be supported.  Valid ar‐\nguments are as follows:\n\ndisable type  Disable the specified type of authentication.  To obtain a list of\navailable types, use the auth disable ? command.\n\nenable type   Enable the specified type of authentication.  To obtain a list of\navailable types, use the auth enable ? command.\n\nstatus        List the current status of the various types of authentication.\n\nNote that the current version of telnet does not support authentication.\n\nclose      Close the connection to the remote host, if any, and return to command mode.\n\ndisplay argument ...\nDisplay all, or some, of the set and toggle values (see below).\n\nencrypt argument ...\nThe encrypt command controls the TELNET ENCRYPT protocol option. If telnet was com‐\npiled without encryption, the encrypt command will not be supported.\n\nValid arguments are as follows:\n\ndisable type [input|output]\nDisable the specified type of encryption.  If you do not specify input\nor output, encryption of both is disabled.  To obtain a list of avail‐\nable types, use ``encrypt disable ?''.\n\nenable type [input|output]\nEnable the specified type of encryption.  If you do not specify input\nor output, encryption of both is enabled.  To obtain a list of avail‐\nable types, use ``encrypt enable ?''.\n\ninput         This is the same as ``encrypt start input''.\n\n-input        This is the same as ``encrypt stop input''.\n\noutput        This is the same as ``encrypt start output''.\n\n-output       This is the same as ``encrypt stop output''.\n\nstart [input|output]\nAttempt to begin encrypting.  If you do not specify input or output,\nencryption of both input and output is started.\n\nstatus        Display the current status of the encryption module.\n\nstop [input|output]\nStop encrypting.  If you do not specify input or output, encryption of\nboth is stopped.\n\ntype type     Sets the default type of encryption to be used with later ``encrypt\nstart'' or ``encrypt stop'' commands.\n\nNote that the current version of telnet does not support encryption.\n\nenviron arguments...\nThe environ command is used to propagate environment variables across the telnet\nlink using the TELNET NEW-ENVIRON protocol option.  All variables exported from the\nshell are defined, but only the DISPLAY and PRINTER variables are marked to be sent\nby default.  The USER variable is marked to be sent if the -a or -l command-line op‐\ntions were used.\n\nValid arguments for the environ command are:\n\ndefine variable value\nDefine the variable variable to have a value of value. Any variables de‐\nfined by this command are automatically marked for propagation (``ex‐\nported'').  The value may be enclosed in single or double quotes so that\ntabs and spaces may be included.\n\nundefine variable\nRemove any existing definition of variable.\n\nexport variable\nMark the specified variable for propagation to the remote host.\n\nunexport variable\nDo not mark the specified variable for propagation to the remote host.\nThe remote host may still ask explicitly for variables that are not ex‐\nported.\n\nlist        List the current set of environment variables.  Those marked with a *\nwill be propagated to the remote host. The remote host may still ask ex‐\nplicitly for the rest.\n\n?           Prints out help information for the environ command.\n\nlogout     Send the TELNET LOGOUT protocol option to the remote host.  This command is similar\nto a close command. If the remote host does not support the LOGOUT option, nothing\nhappens.  But if it does, this command should cause it to close the connection.  If\nthe remote side also supports the concept of suspending a user's session for later\nreattachment, the logout command indicates that the session should be terminated im‐\nmediately.\n\nmode type  Type is one of several options, depending on the state of the session.  Telnet asks\nthe remote host to go into the requested mode. If the remote host says it can, that\nmode takes effect.\n\ncharacter     Disable the TELNET LINEMODE option, or, if the remote side does not\nunderstand the LINEMODE option, then enter “character at a time“ mode.\n\nline          Enable the TELNET LINEMODE option, or, if the remote side does not un‐\nderstand the LINEMODE option, then attempt to enter “old-line-by-line“\nmode.\n\nisig (-isig)  Attempt to enable (disable) the TRAPSIG mode of the LINEMODE option.\nThis requires that the LINEMODE option be enabled.\n\nedit (-edit)  Attempt to enable (disable) the EDIT mode of the LINEMODE option.\nThis requires that the LINEMODE option be enabled.\n\nsofttabs (-softtabs)\nAttempt to enable (disable) the SOFTTAB mode of the LINEMODE option.\nThis requires that the LINEMODE option be enabled.\n\nlitecho (-litecho)\nAttempt to enable (disable) the LITECHO mode of the LINEMODE option.\nThis requires that the LINEMODE option be enabled.\n\n?             Prints out help information for the mode command.\n\nopen host [[-l] user][- port]\nOpen a connection to the named host.  If no port number is specified, telnet will\nattempt to contact a telnet daemon at the standard port (23).  The host specifica‐\ntion may be a host name or IP address.  The -l option may be used to specify a user\nname to be passed to the remote system, like the -l command-line option.\n\nWhen connecting to ports other than the telnet port, telnet does not attempt telnet\nprotocol negotiations. This makes it possible to connect to services that do not\nsupport the telnet protocol without making a mess. Protocol negotiation can be\nforced by placing a dash before the port number.\n\nAfter establishing a connection, any commands associated with the remote host in\n/etc/telnetrc and the user's .telnetrc file are executed, in that order.\n\nThe format of the telnetrc files is as follows: Lines beginning with a #, and blank\nlines, are ignored.  The rest of the file should consist of hostnames and sequences\nof telnet commands to use with that host. Commands should be one per line, indented\nby whitespace; lines beginning without whitespace are interpreted as hostnames.\nLines beginning with the special hostname ‘DEFAULT’ will apply to all hosts.  Host‐\nnames including ‘DEFAULT’ may be followed immediately by a colon and a port number\nor string.  If a port is specified it must match exactly with what is specified on\nthe command line.  If no port was specified on the command line, then the value\n‘telnet’ is used.  Upon connecting to a particular host, the commands associated\nwith that host are executed.\n\nquit       Close any open session and exit telnet.  An end of file condition on input, when in\ncommand mode, will trigger this operation as well.\n\nsend arguments\nSend one or more special telnet protocol character sequences to the remote host.\nThe following are the codes which may be specified (more than one may be used in one\ncommand):\n\nabort   Sends the TELNET ABORT (Abort Processes) sequence.\n\nao      Sends the TELNET AO (Abort Output) sequence, which should cause the remote\nsystem to flush all output from the remote system to the user's terminal.\n\nayt     Sends the TELNET AYT (Are You There?) sequence, to which the remote system\nmay or may not choose to respond.\n\nbrk     Sends the TELNET BRK (Break) sequence, which may have significance to the\nremote system.\n\nec      Sends the TELNET EC (Erase Character) sequence, which should cause the re‐\nmote system to erase the last character entered.\n\nel      Sends the TELNET EL (Erase Line) sequence, which should cause the remote\nsystem to erase the line currently being entered.\n\neof     Sends the TELNET EOF (End Of File) sequence.\n\neor     Sends the TELNET EOR (End of Record) sequence.\n\nescape  Sends the current telnet escape character.\n\nga      Sends the TELNET GA (Go Ahead) sequence, which likely has no significance to\nthe remote system.\n\ngetstatus\nIf the remote side supports the TELNET STATUS command, getstatus will send\nthe subnegotiation to request that the server send its current option sta‐\ntus.\n\nip      Sends the TELNET IP (Interrupt Process) sequence, which should cause the re‐\nmote system to abort the currently running process.\n\nnop     Sends the TELNET NOP (No Operation) sequence.\n\nsusp    Sends the TELNET SUSP (Suspend Process) sequence.\n\nsynch   Sends the TELNET SYNCH sequence.  This sequence causes the remote system to\ndiscard all previously typed (but not yet read) input.  This sequence is\nsent as TCP urgent data (and may not work if the remote system is a 4.2BSD\nsystem -- if it doesn't work, a lower case “r” may be echoed on the termi‐\nnal).\n\ndo cmd\n\ndont cmd\n\nwill cmd\n\nwont cmd\nSends the TELNET DO cmd sequence.  cmd can be either a decimal number be‐\ntween 0 and 255, or a symbolic name for a specific TELNET command.  cmd can\nalso be either help or ? to print out help information, including a list of\nknown symbolic names.\n\n?       Prints out help information for the send command.\n\nset argument value\n\nunset argument value\nThe set command will set any one of a number of telnet variables to a specific value\nor to TRUE.  The special value off turns off the function associated with the vari‐\nable. This is equivalent to using the unset command.  The unset command will disable\nor set to FALSE any of the specified variables.  The values of variables may be in‐\nterrogated with the display command.  The variables which may be set or unset, but\nnot toggled, are listed here.  In addition, any of the variables for the toggle com‐\nmand may be explicitly set or unset.\n\nayt     If telnet is in localchars mode, or LINEMODE is enabled, and the status\ncharacter is typed, a TELNET AYT sequence is sent to the remote host.  The\ninitial value for the \"Are You There\" character is the terminal's status\ncharacter.\n\necho    This is the value (initially “^E”) which, when in “line by line” mode, tog‐\ngles between doing local echoing of entered characters (for normal process‐\ning), and suppressing echoing of entered characters (for entering, say, a\npassword).\n\neof     If telnet is operating in LINEMODE or “old line by line” mode, entering this\ncharacter as the first character on a line will cause this character to be\nsent to the remote system.  The initial value of the eof character is taken\nto be the terminal's eof character.\n\nerase   If telnet is in localchars mode (see toggle localchars below), and if telnet\nis operating in “character at a time” mode, then when this character is\ntyped, a TELNET EC sequence (see send ec above) is sent to the remote sys‐\ntem.  The initial value for the erase character is taken to be the termi‐\nnal's erase character.\n\nescape  This is the telnet escape character (initially “^]”) which causes entry into\ntelnet command mode (when connected to a remote system).\n\nflushoutput\nIf telnet is in localchars mode (see toggle localchars below) and the\nflushoutput character is typed, a TELNET AO sequence (see send ao above) is\nsent to the remote host.  The initial value for the flush character is taken\nto be the terminal's flush character.\n\nforw1\n\nforw2   If TELNET is operating in LINEMODE, these are the characters that, when\ntyped, cause partial lines to be forwarded to the remote system.  The ini‐\ntial value for the forwarding characters are taken from the terminal's eol\nand eol2 characters.\n\ninterrupt\nIf telnet is in localchars mode (see toggle localchars below) and the\ninterrupt character is typed, a TELNET IP sequence (see send ip above) is\nsent to the remote host.  The initial value for the interrupt character is\ntaken to be the terminal's intr character.\n\nkill    If telnet is in localchars mode (see toggle localchars below), and if telnet\nis operating in “character at a time” mode, then when this character is\ntyped, a TELNET EL sequence (see send el above) is sent to the remote sys‐\ntem.  The initial value for the kill character is taken to be the terminal's\nkill character.\n\nlnext   If telnet is operating in LINEMODE or “old line by line“ mode, then this\ncharacter is taken to be the terminal's lnext character.  The initial value\nfor the lnext character is taken to be the terminal's lnext character.\n\nquit    If telnet is in localchars mode (see toggle localchars below) and the quit\ncharacter is typed, a TELNET BRK sequence (see send brk above) is sent to\nthe remote host.  The initial value for the quit character is taken to be\nthe terminal's quit character.\n\nreprint\nIf telnet is operating in LINEMODE or “old line by line“ mode, then this\ncharacter is taken to be the terminal's reprint character.  The initial\nvalue for the reprint character is taken to be the terminal's reprint char‐\nacter.\n\nrlogin  This is the rlogin mode escape character. Setting it enables rlogin mode, as\nwith the r command-line option (q.v.)\n\nstart   If the TELNET TOGGLE-FLOW-CONTROL option has been enabled, then this charac‐\nter is taken to be the terminal's start character.  The initial value for\nthe kill character is taken to be the terminal's start character.\n\nstop    If the TELNET TOGGLE-FLOW-CONTROL option has been enabled, then this charac‐\nter is taken to be the terminal's stop character.  The initial value for the\nkill character is taken to be the terminal's stop character.\n\nsusp    If telnet is in localchars mode, or LINEMODE is enabled, and the suspend\ncharacter is typed, a TELNET SUSP sequence (see send susp above) is sent to\nthe remote host.  The initial value for the suspend character is taken to be\nthe terminal's suspend character.\n\ntracefile\nThis is the file to which the output, caused by netdata or option tracing\nbeing TRUE, will be written.  If it is set to “-”, then tracing information\nwill be written to standard output (the default).\n\nworderase\nIf telnet is operating in LINEMODE or “old line by line“ mode, then this\ncharacter is taken to be the terminal's worderase character.  The initial\nvalue for the worderase character is taken to be the terminal's worderase\ncharacter.\n\n?       Displays the legal set (unset) commands.\n\nslc state  The slc command (Set Local Characters) is used to set or change the state of the the\nspecial characters when the TELNET LINEMODE option has been enabled.  Special char‐\nacters are characters that get mapped to TELNET commands sequences (like ip or quit)\nor line editing characters (like erase and kill).  By default, the local special\ncharacters are exported.\n\ncheck       Verify the current settings for the current special characters.  The re‐\nmote side is requested to send all the current special character set‐\ntings, and if there are any discrepancies with the local side, the local\nside will switch to the remote value.\n\nexport      Switch to the local defaults for the special characters.  The local de‐\nfault characters are those of the local terminal at the time when telnet\nwas started.\n\nimport      Switch to the remote defaults for the special characters.  The remote\ndefault characters are those of the remote system at the time when the\nTELNET connection was established.\n\n?           Prints out help information for the slc command.\n\nstatus     Show the current status of telnet.  This includes the name of the remote host, if\nany, as well as the current mode.\n\ntoggle arguments ...\nToggle (between TRUE and FALSE) various flags that control how telnet responds to\nevents.  These flags may be set explicitly to TRUE or FALSE using the set and unset\ncommands.  More than one flag may be toggled at once.  The state of these flags may\nbe examined with the display command.  Valid flags are:\n\nauthdebug     Turns on debugging for the authentication code. This flag only exists\nif authentication support is enabled.\n\nautoflush     If autoflush and localchars are both TRUE, then when the ao, or quit\ncharacters are recognized (and transformed into TELNET sequences; see\nset above for details), telnet refuses to display any data on the\nuser's terminal until the remote system acknowledges (via a TELNET\nTIMING MARK option) that it has processed those TELNET sequences.  The\ninitial value for this toggle is TRUE if the terminal user had not\ndone an \"stty noflsh\", otherwise FALSE (see stty(1)).\n\nautodecrypt   When the TELNET ENCRYPT option is negotiated, by default the actual\nencryption (decryption) of the data stream does not start automati‐\ncally.  The autoencrypt (autodecrypt) command states that encryption\nof the output (input) stream should be enabled as soon as possible.\n\nNote that this flag exists only if encryption support is enabled.\n\nautologin     If the remote side supports the TELNET AUTHENTICATION option, telnet\nattempts to use it to perform automatic authentication.  If the TELNET\nAUTHENTICATION option is not supported, the user's login name is prop‐\nagated using the TELNET NEW-ENVIRON option.  Setting this flag is the\nsame as specifying the a option to the open command or on the command\nline.\n\nautosynch     If autosynch and localchars are both TRUE, then when either the intr\nor quit characters is typed (see set above for descriptions of the\nintr and quit characters), the resulting telnet sequence sent is fol‐\nlowed by the TELNET SYNCH sequence.  This procedure should cause the\nremote system to begin throwing away all previously typed input until\nboth of the telnet sequences have been read and acted upon.  The ini‐\ntial value of this toggle is FALSE.\n\nbinary        Enable or disable the TELNET BINARY option on both input and output.\n\ninbinary      Enable or disable the TELNET BINARY option on input.\n\noutbinary     Enable or disable the TELNET BINARY option on output.\n\ncrlf          If this is TRUE, then carriage returns will be sent as <CR><LF>.  If\nthis is FALSE, then carriage returns will be send as <CR><NUL>.  The\ninitial value for this toggle is FALSE.\n\ncrmod         Toggle carriage return mode.  When this mode is enabled, most carriage\nreturn characters received from the remote host will be mapped into a\ncarriage return followed by a line feed.  This mode does not affect\nthose characters typed by the user, only those received from the re‐\nmote host.  This mode is not very useful unless the remote host only\nsends carriage return, but never line feed.  The initial value for\nthis toggle is FALSE.\n\ndebug         Toggles socket level debugging (useful only to the super user).  The\ninitial value for this toggle is FALSE.\n\nencdebug      Turns on debugging information for the encryption code.  Note that\nthis flag only exists if encryption support is available.\n\nlocalchars    If this is TRUE, then the flush, interrupt, quit, erase, and kill\ncharacters (see set above) are recognized locally, and transformed\ninto (hopefully) appropriate TELNET control sequences (respectively\nao, ip, brk, ec, and el; see send above).  The initial value for this\ntoggle is TRUE in “old line by line” mode, and FALSE in “character at\na time” mode.  When the LINEMODE option is enabled, the value of\nlocalchars is ignored, and assumed to always be TRUE.  If LINEMODE has\never been enabled, then quit is sent as abort, and eof and suspend are\nsent as eof and susp, see send above).\n\nnetdata       Toggles the display of all network data (in hexadecimal format).  The\ninitial value for this toggle is FALSE.\n\noptions       Toggles the display of some internal telnet protocol processing (hav‐\ning to do with telnet options).  The initial value for this toggle is\nFALSE.\n\nprettydump    When the netdata toggle is enabled, if prettydump is enabled the out‐\nput from the netdata command will be formatted in a more user-readable\nformat.  Spaces are put between each character in the output, and the\nbeginning of telnet escape sequences are preceded by a '*' to aid in\nlocating them.\n\nskiprc        When the skiprc toggle is TRUE, telnet does not read the telnetrc\nfiles.  The initial value for this toggle is FALSE.\n\ntermdata      Toggles the display of all terminal data (in hexadecimal format).  The\ninitial value for this toggle is FALSE.\n\nverboseencrypt\nWhen the verboseencrypt toggle is TRUE, TELNET prints out a message\neach time encryption is enabled or disabled.  The initial value for\nthis toggle is FALSE. This flag only exists if encryption support is\navailable.\n\n?             Displays the legal toggle commands.\n\nz          Suspend telnet.  This command only works when the user is using the csh(1).\n\n! [command]\nExecute a single command in a subshell on the local system.  If command is omitted,\nthen an interactive subshell is invoked.\n\n? [command]\nGet help.  With no arguments, telnet prints a help summary.  If a command is speci‐\nfied, telnet will print the help information for just that command.\n\n### ENVIRONMENT\n\nTelnet uses at least the HOME, SHELL, DISPLAY, and TERM environment variables.  Other environ‐\nment variables may be propagated to the other side via the TELNET NEW-ENVIRON option.\n\n### FILES\n\n/etc/telnetrc  global telnet startup values\n~/.telnetrc    user customized telnet startup values\n\n### HISTORY\n\nThe Telnet command appeared in 4.2BSD.\n\n### NOTES\n\nOn some remote systems, echo has to be turned off manually when in “old line by line” mode.\n\nIn “old line by line” mode or LINEMODE the terminal's eof character is only recognized (and\nsent to the remote system) when it is the first character on a line.\n\n### BUGS\n\nThe source code is not comprehensible.\n\n### Linux NetKit (0.17)             August 15, 1999            Linux NetKit (0.17)\n\n"
        }
    ],
    "structuredContent": {
        "command": "telnet",
        "section": "1",
        "mode": "man",
        "summary": "telnet — user interface to the TELNET protocol",
        "synopsis": "telnet [-468ELadr] [-S tos] [-b address] [-e escapechar] [-l user] [-n tracefile] [host [port]]",
        "tldr_summary": "Connect to a specified port of a host using the telnet protocol.",
        "tldr_examples": [
            {
                "description": "Telnet to the default port of a host",
                "command": "telnet {{host}}"
            },
            {
                "description": "Telnet to a specific port of a host",
                "command": "telnet {{ip_address}} {{port}}"
            },
            {
                "description": "[Interactive] Exit a telnet session",
                "command": "quit"
            },
            {
                "description": "Emit the default escape character combination for terminating the session",
                "command": "<Ctrl ]>"
            },
            {
                "description": "Start `telnet` with \"x\" as the session termination character",
                "command": "telnet {{-e|--escape}} {{x}} {{ip_address}} {{port}}"
            },
            {
                "description": "Telnet to Star Wars animation",
                "command": "telnet {{towel.blinkenlights.nl}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-4",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "-6",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "-8",
                "long": null,
                "arg": null,
                "description": "for both input and output. By default telnet is not 8-bit clean."
            },
            {
                "flag": "-E",
                "long": null,
                "arg": null,
                "description": "character''."
            },
            {
                "flag": "-L",
                "long": null,
                "arg": null,
                "description": "gotiated on just output."
            },
            {
                "flag": "-a",
                "long": null,
                "arg": null,
                "description": "the NEW-ENVIRON option if supported by the remote system. The username is retrieved via getlogin(3)."
            },
            {
                "flag": "-b",
                "long": null,
                "arg": null,
                "description": "Use bind(2) on the local socket to bind it to a specific local address."
            },
            {
                "flag": "-d",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "-r",
                "long": null,
                "arg": null,
                "description": "interpretation of the escape character is changed: an escape character followed by a dot causes telnet to disconnect from the remote host. A ^Z instead of a dot suspends telnet, and a ^] (the default telnet escape character) generates a normal telnet prompt. These codes are accepted only at the beginning of a line."
            },
            {
                "flag": "-S",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "-e",
                "long": null,
                "arg": null,
                "description": "Sets the escape character to escapechar. If no character is supplied, no escape charac‐ ter will be used. Entering the escape character while connected causes telnet to drop to command mode."
            },
            {
                "flag": "-l",
                "long": null,
                "arg": null,
                "description": "Specify user as the user to log in as on the remote system. This is accomplished by sending the specified name as the USER environment variable, so it requires that the remote system support the TELNET NEW-ENVIRON option. This option implies the -a option, and may also be used with the open command."
            },
            {
                "flag": "-n",
                "long": null,
                "arg": null,
                "description": "Opens tracefile for recording trace information. See the set tracefile command below. host Specifies a host to contact over the network. port Specifies a port number or service name to contact. If not specified, the telnet port (23) is used. Protocol: Once a connection has been opened, telnet will attempt to enable the TELNET LINEMODE 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 pro‐ cessing. 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“; see below), 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 be‐ low) which cause this action to flush subsequent output to the terminal (until the remote host acknowledges the TELNET sequence) and flush previous terminal input (in the case of quit and intr). Commands: The following telnet commands are available. Unique prefixes are understood as abbreviations. auth argument ... The auth command controls the TELNET AUTHENTICATE protocol option. If telnet was compiled without authentication, the auth command will not be supported. Valid ar‐ guments are as follows: disable type Disable the specified type of authentication. To obtain a list of available types, use the auth disable ? command. enable type Enable the specified type of authentication. To obtain a list of available types, use the auth enable ? command. status List the current status of the various types of authentication. Note that the current version of telnet does not support authentication. close Close the connection to the remote host, if any, and return to command mode. display argument ... Display all, or some, of the set and toggle values (see below). encrypt argument ... The encrypt command controls the TELNET ENCRYPT protocol option. If telnet was com‐ piled without encryption, the encrypt command will not be supported. Valid arguments are as follows: disable type [input|output] Disable the specified type of encryption. If you do not specify input or output, encryption of both is disabled. To obtain a list of avail‐ able types, use ``encrypt disable ?''. enable type [input|output] Enable the specified type of encryption. If you do not specify input or output, encryption of both is enabled. To obtain a list of avail‐ able types, use ``encrypt enable ?''. input This is the same as ``encrypt start input''. -input This is the same as ``encrypt stop input''. output This is the same as ``encrypt start output''. -output This is the same as ``encrypt stop output''. start [input|output] Attempt to begin encrypting. If you do not specify input or output, encryption of both input and output is started. status Display the current status of the encryption module. stop [input|output] Stop encrypting. If you do not specify input or output, encryption of both is stopped. type type Sets the default type of encryption to be used with later ``encrypt start'' or ``encrypt stop'' commands. Note that the current version of telnet does not support encryption. environ arguments... The environ command is used to propagate environment variables across the telnet link using the TELNET NEW-ENVIRON protocol option. All variables exported from the shell are defined, but only the DISPLAY and PRINTER variables are marked to be sent by default. The USER variable is marked to be sent if the -a or -l command-line op‐ tions were used. Valid arguments for the environ command are: define variable value Define the variable variable to have a value of value. Any variables de‐ fined by this command are automatically marked for propagation (``ex‐ ported''). The value may be enclosed in single or double quotes so that tabs and spaces may be included. undefine variable Remove any existing definition of variable. export variable Mark the specified variable for propagation to the remote host. unexport variable Do not mark the specified variable for propagation to the remote host. The remote host may still ask explicitly for variables that are not ex‐ ported. list List the current set of environment variables. Those marked with a * will be propagated to the remote host. The remote host may still ask ex‐ plicitly for the rest. ? Prints out help information for the environ command. logout Send the TELNET LOGOUT protocol option to the remote host. This command is similar to a close command. If the remote host does not support the LOGOUT option, nothing happens. But if it does, this command should cause it to close the connection. If the remote side also supports the concept of suspending a user's session for later reattachment, the logout command indicates that the session should be terminated im‐ mediately. mode type Type is one of several options, depending on the state of the session. Telnet asks the remote host to go into the requested mode. If the remote host says it can, that mode takes effect. character Disable the TELNET LINEMODE option, or, if the remote side does not understand the LINEMODE option, then enter “character at a time“ mode. line Enable the TELNET LINEMODE option, or, if the remote side does not un‐ derstand the LINEMODE option, then attempt to enter “old-line-by-line“ mode. isig (-isig) Attempt to enable (disable) the TRAPSIG mode of the LINEMODE option. This requires that the LINEMODE option be enabled. edit (-edit) Attempt to enable (disable) the EDIT mode of the LINEMODE option. This requires that the LINEMODE option be enabled. softtabs (-softtabs) Attempt to enable (disable) the SOFTTAB mode of the LINEMODE option. This requires that the LINEMODE option be enabled. litecho (-litecho) Attempt to enable (disable) the LITECHO mode of the LINEMODE option. This requires that the LINEMODE option be enabled. ? Prints out help information for the mode command. open host [[-l] user][- port] Open a connection to the named host. If no port number is specified, telnet will attempt to contact a telnet daemon at the standard port (23). The host specifica‐ tion may be a host name or IP address. The -l option may be used to specify a user name to be passed to the remote system, like the -l command-line option. When connecting to ports other than the telnet port, telnet does not attempt telnet protocol negotiations. This makes it possible to connect to services that do not support the telnet protocol without making a mess. Protocol negotiation can be forced by placing a dash before the port number. After establishing a connection, any commands associated with the remote host in /etc/telnetrc and the user's .telnetrc file are executed, in that order. The format of the telnetrc files is as follows: Lines beginning with a #, and blank lines, are ignored. The rest of the file should consist of hostnames and sequences of telnet commands to use with that host. Commands should be one per line, indented by whitespace; lines beginning without whitespace are interpreted as hostnames. Lines beginning with the special hostname ‘DEFAULT’ will apply to all hosts. Host‐ names including ‘DEFAULT’ may be followed immediately by a colon and a port number or string. If a port is specified it must match exactly with what is specified on the command line. If no port was specified on the command line, then the value ‘telnet’ is used. Upon connecting to a particular host, the commands associated with that host are executed. quit Close any open session and exit telnet. An end of file condition on input, when in command mode, will trigger this operation as well. send arguments Send one or more special telnet protocol character sequences to the remote host. The following are the codes which may be specified (more than one may be used in one command): abort Sends the TELNET ABORT (Abort Processes) sequence. ao Sends the TELNET AO (Abort Output) sequence, which should cause the remote system to flush all output from the remote system to the user's terminal. ayt Sends the TELNET AYT (Are You There?) sequence, to which the remote system may or may not choose to respond. brk Sends the TELNET BRK (Break) sequence, which may have significance to the remote system. ec Sends the TELNET EC (Erase Character) sequence, which should cause the re‐ mote system to erase the last character entered. el Sends the TELNET EL (Erase Line) sequence, which should cause the remote system to erase the line currently being entered. eof Sends the TELNET EOF (End Of File) sequence. eor Sends the TELNET EOR (End of Record) sequence. escape Sends the current telnet escape character. ga Sends the TELNET GA (Go Ahead) sequence, which likely has no significance to the remote system. getstatus If the remote side supports the TELNET STATUS command, getstatus will send the subnegotiation to request that the server send its current option sta‐ tus. ip Sends the TELNET IP (Interrupt Process) sequence, which should cause the re‐ mote system to abort the currently running process. nop Sends the TELNET NOP (No Operation) sequence. susp Sends the TELNET SUSP (Suspend Process) sequence. synch Sends the TELNET SYNCH sequence. This sequence causes the remote system to discard all previously typed (but not yet read) input. This sequence is sent as TCP urgent data (and may not work if the remote system is a 4.2BSD system -- if it doesn't work, a lower case “r” may be echoed on the termi‐ nal). do cmd dont cmd will cmd wont cmd Sends the TELNET DO cmd sequence. cmd can be either a decimal number be‐ tween 0 and 255, or a symbolic name for a specific TELNET command. cmd can also be either help or ? to print out help information, including a list of known symbolic names. ? Prints out help information for the send command. set argument value unset argument value The set command will set any one of a number of telnet variables to a specific value or to TRUE. The special value off turns off the function associated with the vari‐ able. This is equivalent to using the unset command. The unset command will disable or set to FALSE any of the specified variables. The values of variables may be in‐ terrogated with the display command. The variables which may be set or unset, but not toggled, are listed here. In addition, any of the variables for the toggle com‐ mand may be explicitly set or unset. ayt If telnet is in localchars mode, or LINEMODE is enabled, and the status character is typed, a TELNET AYT sequence is sent to the remote host. The initial value for the \"Are You There\" character is the terminal's status character. echo This is the value (initially “^E”) which, when in “line by line” mode, tog‐ gles between doing local echoing of entered characters (for normal process‐ ing), and suppressing echoing of entered characters (for entering, say, a password). eof If telnet is operating in LINEMODE or “old line by line” mode, entering this character as the first character on a line will cause this character to be sent to the remote system. The initial value of the eof character is taken to be the terminal's eof character. erase If telnet is in localchars mode (see toggle localchars below), and if telnet is operating in “character at a time” mode, then when this character is typed, a TELNET EC sequence (see send ec above) is sent to the remote sys‐ tem. The initial value for the erase character is taken to be the termi‐ nal's erase character. escape This is the telnet escape character (initially “^]”) which causes entry into telnet command mode (when connected to a remote system). flushoutput If telnet is in localchars mode (see toggle localchars below) and the flushoutput character is typed, a TELNET AO sequence (see send ao above) is sent to the remote host. The initial value for the flush character is taken to be the terminal's flush character. forw1 forw2 If TELNET is operating in LINEMODE, these are the characters that, when typed, cause partial lines to be forwarded to the remote system. The ini‐ tial value for the forwarding characters are taken from the terminal's eol and eol2 characters. interrupt If telnet is in localchars mode (see toggle localchars below) and the interrupt character is typed, a TELNET IP sequence (see send ip above) is sent to the remote host. The initial value for the interrupt character is taken to be the terminal's intr character. kill If telnet is in localchars mode (see toggle localchars below), and if telnet is operating in “character at a time” mode, then when this character is typed, a TELNET EL sequence (see send el above) is sent to the remote sys‐ tem. The initial value for the kill character is taken to be the terminal's kill character. lnext If telnet is operating in LINEMODE or “old line by line“ mode, then this character is taken to be the terminal's lnext character. The initial value for the lnext character is taken to be the terminal's lnext character. quit If telnet is in localchars mode (see toggle localchars below) and the quit character is typed, a TELNET BRK sequence (see send brk above) is sent to the remote host. The initial value for the quit character is taken to be the terminal's quit character. reprint If telnet is operating in LINEMODE or “old line by line“ mode, then this character is taken to be the terminal's reprint character. The initial value for the reprint character is taken to be the terminal's reprint char‐ acter. rlogin This is the rlogin mode escape character. Setting it enables rlogin mode, as with the r command-line option (q.v.) start If the TELNET TOGGLE-FLOW-CONTROL option has been enabled, then this charac‐ ter is taken to be the terminal's start character. The initial value for the kill character is taken to be the terminal's start character. stop If the TELNET TOGGLE-FLOW-CONTROL option has been enabled, then this charac‐ ter is taken to be the terminal's stop character. The initial value for the kill character is taken to be the terminal's stop character. susp If telnet is in localchars mode, or LINEMODE is enabled, and the suspend character is typed, a TELNET SUSP sequence (see send susp above) is sent to the remote host. The initial value for the suspend character is taken to be the terminal's suspend character. tracefile This is the file to which the output, caused by netdata or option tracing being TRUE, will be written. If it is set to “-”, then tracing information will be written to standard output (the default). worderase If telnet is operating in LINEMODE or “old line by line“ mode, then this character is taken to be the terminal's worderase character. The initial value for the worderase character is taken to be the terminal's worderase character. ? Displays the legal set (unset) commands. slc state The slc command (Set Local Characters) is used to set or change the state of the the special characters when the TELNET LINEMODE option has been enabled. Special char‐ acters are characters that get mapped to TELNET commands sequences (like ip or quit) or line editing characters (like erase and kill). By default, the local special characters are exported. check Verify the current settings for the current special characters. The re‐ mote side is requested to send all the current special character set‐ tings, and if there are any discrepancies with the local side, the local side will switch to the remote value. export Switch to the local defaults for the special characters. The local de‐ fault characters are those of the local terminal at the time when telnet was started. import Switch to the remote defaults for the special characters. The remote default characters are those of the remote system at the time when the TELNET connection was established. ? Prints out help information for the slc command. status Show the current status of telnet. This includes the name of the remote host, if any, as well as the current mode. toggle arguments ... Toggle (between TRUE and FALSE) various flags that control how telnet responds to events. These flags may be set explicitly to TRUE or FALSE using the set and unset commands. More than one flag may be toggled at once. The state of these flags may be examined with the display command. Valid flags are: authdebug Turns on debugging for the authentication code. This flag only exists if authentication support is enabled. autoflush If autoflush and localchars are both TRUE, then when the ao, or quit characters are recognized (and transformed into TELNET sequences; see set above for details), telnet refuses to display any data on the user's terminal until the remote system acknowledges (via a TELNET TIMING MARK option) that it has processed those TELNET sequences. The initial value for this toggle is TRUE if the terminal user had not done an \"stty noflsh\", otherwise FALSE (see stty(1)). autodecrypt When the TELNET ENCRYPT option is negotiated, by default the actual encryption (decryption) of the data stream does not start automati‐ cally. The autoencrypt (autodecrypt) command states that encryption of the output (input) stream should be enabled as soon as possible. Note that this flag exists only if encryption support is enabled. autologin If the remote side supports the TELNET AUTHENTICATION option, telnet attempts to use it to perform automatic authentication. If the TELNET AUTHENTICATION option is not supported, the user's login name is prop‐ agated using the TELNET NEW-ENVIRON option. Setting this flag is the same as specifying the a option to the open command or on the command line. autosynch If autosynch and localchars are both TRUE, then when either the intr or quit characters is typed (see set above for descriptions of the intr and quit characters), the resulting telnet sequence sent is fol‐ lowed by the TELNET SYNCH sequence. This procedure should cause the remote system to begin throwing away all previously typed input until both of the telnet sequences have been read and acted upon. The ini‐ tial value of this toggle is FALSE. binary Enable or disable the TELNET BINARY option on both input and output. inbinary Enable or disable the TELNET BINARY option on input. outbinary Enable or disable the TELNET BINARY option on output. crlf If this is TRUE, then carriage returns will be sent as <CR><LF>. If this is FALSE, then carriage returns will be send as <CR><NUL>. The initial value for this toggle is FALSE. crmod Toggle carriage return mode. When this mode is enabled, most carriage return characters received from the remote host will be mapped into a carriage return followed by a line feed. This mode does not affect those characters typed by the user, only those received from the re‐ mote host. This mode is not very useful unless the remote host only sends carriage return, but never line feed. The initial value for this toggle is FALSE. debug Toggles socket level debugging (useful only to the super user). The initial value for this toggle is FALSE. encdebug Turns on debugging information for the encryption code. Note that this flag only exists if encryption support is available. localchars If this is TRUE, then the flush, interrupt, quit, erase, and kill characters (see set above) are recognized locally, and transformed into (hopefully) appropriate TELNET control sequences (respectively ao, ip, brk, ec, and el; see send above). The initial value for this toggle is TRUE in “old line by line” mode, and FALSE in “character at a time” mode. When the LINEMODE option is enabled, the value of localchars is ignored, and assumed to always be TRUE. If LINEMODE has ever been enabled, then quit is sent as abort, and eof and suspend are sent as eof and susp, see send above). netdata Toggles the display of all network data (in hexadecimal format). The initial value for this toggle is FALSE. options Toggles the display of some internal telnet protocol processing (hav‐ ing to do with telnet options). The initial value for this toggle is FALSE. prettydump When the netdata toggle is enabled, if prettydump is enabled the out‐ put from the netdata command will be formatted in a more user-readable format. Spaces are put between each character in the output, and the beginning of telnet escape sequences are preceded by a '*' to aid in locating them. skiprc When the skiprc toggle is TRUE, telnet does not read the telnetrc files. The initial value for this toggle is FALSE. termdata Toggles the display of all terminal data (in hexadecimal format). The initial value for this toggle is FALSE. verboseencrypt When the verboseencrypt toggle is TRUE, TELNET prints out a message each time encryption is enabled or disabled. The initial value for this toggle is FALSE. This flag only exists if encryption support is available. ? Displays the legal toggle commands. z Suspend telnet. This command only works when the user is using the csh(1). ! [command] Execute a single command in a subshell on the local system. If command is omitted, then an interactive subshell is invoked. ? [command] Get help. With no arguments, telnet prints a help summary. If a command is speci‐ fied, telnet will print the help information for just that command."
            }
        ],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 7,
                "subsections": [
                    {
                        "name": "-4",
                        "lines": 1,
                        "flag": "-4"
                    },
                    {
                        "name": "-6",
                        "lines": 1,
                        "flag": "-6"
                    },
                    {
                        "name": "-8",
                        "lines": 2,
                        "flag": "-8"
                    },
                    {
                        "name": "-E",
                        "lines": 2,
                        "flag": "-E"
                    },
                    {
                        "name": "-L",
                        "lines": 2,
                        "flag": "-L"
                    },
                    {
                        "name": "-a",
                        "lines": 3,
                        "flag": "-a"
                    },
                    {
                        "name": "-b",
                        "lines": 2,
                        "flag": "-b"
                    },
                    {
                        "name": "-d",
                        "lines": 1,
                        "flag": "-d"
                    },
                    {
                        "name": "-r",
                        "lines": 5,
                        "flag": "-r"
                    },
                    {
                        "name": "-S",
                        "lines": 1,
                        "flag": "-S"
                    },
                    {
                        "name": "-e",
                        "lines": 4,
                        "flag": "-e"
                    },
                    {
                        "name": "-l",
                        "lines": 5,
                        "flag": "-l"
                    },
                    {
                        "name": "-n",
                        "lines": 493,
                        "flag": "-n"
                    }
                ]
            },
            {
                "name": "ENVIRONMENT",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "FILES",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "HISTORY",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "NOTES",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "BUGS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "Linux NetKit (0.17)             August 15, 1999            Linux NetKit (0.17)",
                "lines": 1,
                "subsections": []
            }
        ]
    }
}