TELNET(1)
TELNET(1) πβ¨
okay bestie, listen β this is from the General Commands Manual, and it's the whole vibe of talking to another computer over the network. let's go π¦
β¨ NAME β¨
telnet β user interface to the TELNET protocol πΈ
β¨ SYNOPSIS β¨
telnet [-468EKLadr] [-S tos] [-X authtype] [-b address] [-e escapechar]
[-l user] [-n tracefile] [-z option] [host [port]]
β¨ DESCRIPTION β¨
So telnet is literally the command for interactive communication with another host using the TELNET protocol π
It starts you off in command mode, where it shows you a telnet prompt that looks like "telnet> ". And here's the cute part β if you invoke telnet with a host argument, it just goes ahead and runs an open command implicitly, no asking. (the description of that is down below, keep reading bestie) π
Options:
-4β Force IPv4 address resolution. old-school IP energy β¨-6β Force IPv6 address resolution. futuristic IP energy β¨-8β Request 8-bit operation. This makes it try to negotiate the TELNET BINARY option for both input and output. Heads up: by defaulttelnetis not 8-bit clean, so this is a whole upgrade π-Eβ Disables the escape character functionality entirely β that is, it sets the escape character tono character'' ``. gone. poof. π«₯-Kβ Specifies no automatic login to the remote system. we're doing this manually, bestie π ββοΈ-Lβ Specifies an 8-bit data path on output. This causes the TELNET BINARY option to be negotiated on just output. (so half the 8-bit glow-up, if u will) π-Xatype β Disables the atype type of authentication.-aβ Attempt automatic login. Right now, this sends the user name via theUSERvariable of the NEW-ENVIRON option β but only if the remote system supports it. The username is retrieved viagetlogin(3). slay π₯-baddress β Usebind(2)on the local socket to bind it to a specific local address. home address, but for sockets π-dβ Sets the initial value of the debug toggle toTRUE. debug mode from the jump π-rβ Emulaterlogin(1). In this mode, the default escape character is a tilde. Also the interpretation of the escape character changes:- an escape character followed by a dot causes
telnetto disconnect from the remote host πͺ - a
^Zinstead of a dot suspendstelnetπ€ - a
^](the default telnet escape character) generates a normal telnet prompt
- an escape character followed by a dot causes
and important: these codes are accepted only at the beginning of a line. no mid-sentence chaos bestie β οΈ
-Stos β Sets the IP type-of-service (TOS) option for the telnet connection to the value tos.-eescapechar β Sets the escape character to escapechar. If no character is supplied, no escape character will be used. Entering the escape character while connected causestelnetto drop to command mode. ur little teleport button β¨-luser β Specify user as the user to log in as on the remote system. This is accomplished by sending the specified name as theUSERenvironment variable, so it requires that the remote system support the TELNET NEW-ENVIRON option. This option implies the-aoption, and may also be used with theopencommand. bestie privileges unlocked π-ntracefile β Opens tracefile for recording trace information. See theset tracefilecommand below. receipts, but saved to disk π-zoption β Set SSL (Secure Socket Layer) parameters. The default is to negotiate via telnet protocol if SSL is available at server side and then to switch it on. In this mode you can connect to both conventional and SSL enhancedtelnetd's.
β οΈ If the connection is made tolocalhostand-z secureis not set, then SSL is not enabled. lowkey important, no cap π
The SSL parameters are:
debugβ Send SSL related debugging information tostderr.authdebugβ Enable authentication debugging.sslβ Negotiate SSL at first, then use TELNET protocol. In this mode you can connect to any server directly supporting SSL, like Apache-SSL. The TELNET protocol negotiation is done encrypted. A typical example is the calltelnet -z ssl mail.google.com https. this is THE iconic move πnossl,!sslβ switch off SSL negotiationcertrequiredβ server certificate is mandatorysecureβ Don't switch back to unencrypted mode (no SSL) if SSL is not available. no downgrades, periodt πverboseβ Be verbose about certificates etc. tell me EVERYTHING π£οΈverify=intβ Set the SSL verify flags. (SeeSSL_VERIFY_*inopenssl/ssl.h.)cacert=CA_fileβ This is used for verification of whatever certificate the remote server cares to send as identifier.cert=cert_fileβ Present the certificate(s) in cert_file to the server. They are in PEM-format, and the first identifies you as a client.key=key_fileβ Use the key(s) in key_file in case a key is not stored together with the certificate.cipher=ciph_listβ Set the preferred ciphers to ciph_list. The environment variableSSL_CIPHERserves the same purpose. (Seeopenssl/ssl.h.)
hostβ Specifies a host to contact over the network. who are we calling today bestie π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 that fails, then telnet reverts 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. it's giving teamwork β¨
In βcharacter at a timeβ mode, most text typed is immediately sent to the remote host for processing. instant. no chill. π¨
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 below) 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. (so u can be lazy and it still works, iconic β¨)
authargument ... β Theauthcommand controls the TELNET AUTHENTICATE protocol option. Iftelnetwas compiled without authentication, theauthcommand will not be supported. Valid arguments are as follows:disabletype β Disable the specified type of authentication. To obtain a list of available types, use theauth disable ?command.enabletype β Enable the specified type of authentication. To obtain a list of available types, use theauth enable ?command.statusβ List the current status of the various types of authentication.
closeβ Close the connection to the remote host, if any, and return to command mode. bye bestie πdisplayargument ... β Display all, or some, of thesetandtogglevalues (see below).environarguments... β Theenvironcommand 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 theDISPLAYandPRINTERvariables are marked to be sent by default. TheUSERvariable is marked to be sent if the-aor-lcommand-line options were used.
Valid arguments for the environ command are:
definevariable value β Define the variable variable to have a value of value. Any variables defined by this command are automatically marked for propagation (exported'' ``). The value may be enclosed in single or double quotes so that tabs and spaces may be included.undefinevariable β Remove any existing definition of variable.exportvariable β Mark the specified variable for propagation to the remote host.unexportvariable β Do not mark the specified variable for propagation to the remote host. The remote host may still ask explicitly for variables that are not exported.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 explicitly for the rest.?β Prints out help information for theenvironcommand.
logoutβ Send the TELNET LOGOUT protocol option to the remote host. This command is similar to aclosecommand. 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, thelogoutcommand indicates that the session should be terminated immediately. it's giving "we're SO done here" πmodetype β Type is one of several options, depending on the state of the session.telnetasks 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β turns on the TELNET LINEMODE option, or if the remote side is giving "idk what that is," it tries to slide into "old-line-by-line" mode instead.isig (-isig)β tries to enable (or disable) the TRAPSIG mode of the LINEMODE option. Heads up bestie: LINEMODE has to be enabled first or this does nothing.edit (-edit)β tries to enable (or disable) the EDIT mode of the LINEMODE option. Also needs LINEMODE enabled. No LINEMODE, no vibes.softtabs (-softtabs)β tries to enable (or disable) the SOFT_TAB mode of the LINEMODE option. Same deal, LINEMODE must be on.litecho (-litecho)β tries to enable (or disable) the LIT_ECHO mode of the LINEMODE option. Yep, you guessed it, LINEMODE required.?β prints out the help info for themodecommand. Self-care.
πΈ open β let's go meet somebody πΈ
open host [[-l] user][- port]
Opens a connection to the named host. If you don't give a port number, telnet tries to reach a telnet daemon at the standard port (23). The host spec can be a host name or an IP address. The -l option lets you name a user to pass along to the remote system, exactly like the -l command-line option.
Now this part is lowkey important, so listen up: when you connect to ports other than the telnet port, telnet does not attempt telnet protocol negotiations. That's a feature, not a bug, bestie β it means you can connect to services that don't speak telnet protocol without making a whole mess. If you do want protocol negotiation anyway, you force it by putting a dash before the port number.
Once the connection is up, any commands tied to that remote host in /etc/telnetrc and in the user's .telnetrc file get executed, in that order. π
The format of the telnetrc files goes like this:
- Lines starting with
#? Ignored. Blank lines? Also ignored. - The rest of the file is hostnames plus sequences of telnet commands to use with that host.
- Commands go one per line, indented by whitespace. Lines that begin without whitespace get read as hostnames.
- Lines starting with the special hostname
DEFAULTapply to all hosts. - Hostnames, including
DEFAULT, may be followed immediately by a colon and a port number or string. If a port is specified, it has to match exactly with whatever was specified on the command line. If no port was specified on the command line, then the valuetelnetis used. - When you connect to a particular host, the commands associated with that host get executed.
π quit β we're done here π
Closes any open session and exits telnet. An end of file condition on input, while you're in command mode, will trigger this too. Bye bestie π«Ά
β¨ send β beam special sequences into the void β¨
send arguments
Sends one or more special telnet protocol character sequences to the remote host. Here are the codes you can specify (and yes, you can use more than one in a single command):
abortβ sends the TELNET ABORT (Abort Processes) sequence.aoβ sends the TELNET AO (Abort Output) sequence, which should make the remote system flush all output going from the remote system to your terminal.aytβ sends the TELNET AYT (Are You There?) sequence. The remote system may or may not choose to respond. Honestly, relatable.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 make the remote system erase the last character entered.elβ sends the TELNET EL (Erase Line) sequence, which should make the remote system erase the line you're currently entering.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. It's giving decoration.getstatusβ if the remote side supports the TELNET STATUS command,getstatussends the subnegotiation requesting that the server send its current option status. Snooping, but politely.ipβ sends the TELNET IP (Interrupt Process) sequence, which should make the remote system 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 one makes the remote system discard all previously typed (but not yet read) input. It's sent as TCP urgent data β and it may not work if the remote system is a 4.2BSD system. If it doesn't work, a lower casermay be echoed on the terminal.do cmddont cmdwill cmdwont cmdβ sends the TELNET DO cmd sequence. cmd can be either a decimal number between 0 and 255, or a symbolic name for a specific TELNET command. cmd can also be eitherhelpor?to print out help information, including a list of known symbolic names.?β prints out help information for thesendcommand.
π set / unset β toggling the variables π
set argument value
unset argument value
The set command sets any one of a bunch of telnet variables to a specific value, or to TRUE. The special value off turns off the function associated with the variable β which is the same thing as using the unset command. The unset command disables, or sets to FALSE, any of the specified variables. You can interrogate the values of variables with the display command. π
The variables listed here can be set or unset, but not toggled. Also, any of the variables for the toggle command can be explicitly set or unset too.
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, toggles between doing local echoing of entered characters (for normal processing) 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 (seetoggle localcharsbelow), and if telnet is operating in "character at a time" mode, then when this character is typed, a TELNET EC sequence (seesend ecabove) is sent to the remote system. The initial value for the erase character is taken to be the terminal'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 (seetoggle localcharsbelow) and the flushoutput character is typed, a TELNET AO sequence (seesend aoabove) is sent to the remote host. The initial value for the flush character is taken to be the terminal's flush character.forw1forw2β if TELNET is operating in LINEMODE, these are the characters that, when typed, cause partial lines to be forwarded to the remote system. The initial values for the forwarding characters are taken from the terminal's eol and eol2 characters.interruptβ if telnet is in localchars mode (seetoggle localcharsbelow) and the interrupt character is typed, a TELNET IP sequence (seesend ipabove) 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 (seetoggle localcharsbelow), and if telnet is operating in "character at a time" mode, then when this character is typed, a TELNET EL sequence (seesend elabove) is sent to the remote system. 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 chillin' in localchars mode (peeptoggle localcharsdown below bestie) and you hit the quit character, a TELNET BRK sequence gets yeeted to the remote host (seesend brkabove). The initial value for the quit character is literally just your terminal's quit character. πreprintβ if telnet is out here operating in LINEMODE or "old line by line" mode, then this character is taken to be the terminal's reprint character. And the initial value for the reprint character? You guessed it, it's taken to be the terminal's reprint character. β¨rloginβ this is the rlogin mode escape character. Setting it enables rlogin mode, exactly like thercommand-line option (q.v.). iconic behavior fr fr πstartβ if the TELNET TOGGLE-FLOW-CONTROL option has been enabled, then this character 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 character 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 gets sent to the remote host (seesend suspabove). The initial value for the suspend character is taken to be the terminal's suspend character. π¦tracefileβ this is the file where all the output fromnetdataor option tracing being TRUE gets written. And if you set it to"-", then tracing information goes straight to standard output (which is the default, btw). π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. Initial value for the worderase character is taken to be the terminal's worderase character. π§?β Displays the legalset(unset) commands. short n sweet, we love her πΈ
π slc state π
The slc command (Set Local Characters) is how you set or change the state of the special characters when the TELNET LINEMODE option has been enabled. So like, what even are special characters? They're the characters that get mapped to TELNET command sequences (think ip or quit) or to line editing characters (think erase and kill). And by default? The local special characters are exported. periodt. π
checkβ verify the current settings for the current special characters. The remote side is requested to send all the current special character settings, and if there's any discrepancy with the local side, the local side will switch to the remote value. vibe check but for characters β¨exportβ switch to the local defaults for the special characters. Those local default characters are the ones from your 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 theslccommand. slay π
π₯ startssl π₯
Attempt to negotiate telnet-over-SSL (same energy as the -z ssl option). This is highkey useful when you're connecting to non-telnetds like imapd (with the STARTTLS command). But heads up bestie: to control SSL when connecting to an SSL-enabled telnetd, use the auth command instead. iykyk π
π status π
Show the current status of telnet. This includes the name of the remote host (if there even is one) as well as the current mode. main character energy, fr fr π
π« toggle arguments ... π«
Toggle (back and forth between TRUE and FALSE) a bunch of flags that control how telnet responds to events. You can also set these flags explicitly to TRUE or FALSE using the set and unset commands. And yes, you can toggle more than one flag at once β multitasking icon. The state of these flags can be examined with the display command. Here are the valid flags, no cap: π¦
authdebugβ turns on debugging for the authentication code. Ngl this flag only exists if authentication support is enabled. πautoflushβ ifautoflushandlocalcharsare both TRUE, then when theaoorquitcharacters are recognized (and transformed into TELNET sequences; seesetabove for details), telnet refuses to display any data on your 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 (seestty(1)). π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 propagated using the TELNET NEW-ENVIRON option. Setting this flag is the same as specifying theaoption to theopencommand or on the command line. πautosynchβ ifautosynchandlocalcharsare both TRUE, then when either theintrorquitcharacters is typed (seesetabove for descriptions of theintrandquitcharacters), the resulting telnet sequence sent is followed 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 initial value of this toggle is FALSE. πbinaryβ enable or disable the TELNET BINARY option on both input and output. both. at once. icon. β¨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. Important: this mode does not affect those characters typed by the user, only those received from the remote host. Also ngl 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. πlocalcharsβ if this is TRUE, then theflush,interrupt,quit,erase, andkillcharacters (seesetabove) are recognized locally, and transformed into (hopefully) appropriate TELNET control sequences (respectivelyao,ip,brk,ec, andel; seesendabove). 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 oflocalcharsis ignored, and assumed to always be TRUE. If LINEMODE has ever been enabled, thenquitis sent asabort, andeofandsuspendare sent aseofandsusp, seesendabove). π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 (having to do with telnet options). The initial value for this toggle is FALSE. πprettydumpβ when thenetdatatoggle is enabled, ifprettydumpis enabled the output from thenetdatacommand 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. cute and functional πskiprcβ when theskiprctoggle 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. β?β Displays the legaltogglecommands. short queen πzβ suspendtelnet. pausing the whole vibe β¨ heads up though: this one only works when you're usingcsh(1), so if that's not your shell, bestie, it's giving nothing π![command] β run a single command in a subshell over on your local system. If you don't hand it a command, it just opens up an interactive subshell instead π lowkey a whole side quest?[command] β help time!! π With no arguments at all,telnetprints a help summary. But if you pass a command, it prints the help info for just that command β targeted, specific, main character energy π
πΈ ENVIRONMENT πΈ
telnet uses at least these environment variables, no cap:
HOMESHELLDISPLAYTERM
Other environment variables may get propagated over to the other side via the TELNET NEW-ENVIRON option π (it's giving "sharing is caring" but for env vars).
And the variable SSL_CIPHER gets accessed when setting up encrypted traffic πβ¨
π FILES π
/etc/telnetrcβ globaltelnetstartup values π~/.telnetrcβ your own user customizedtelnetstartup values π (this is your house, your rules)
π°οΈ HISTORY π°οΈ
The Telnet command appeared in 4.2BSD. ancient. iconic. still here. π
π NOTES π
On some remote systems, echo has to be turned off manually when you're in βold line by lineβ mode. like, nobody's gonna do it for you bestie π
Also: in βold line by lineβ mode or LINEMODE, the terminal's eof character is only recognized (and sent to the remote system) when it is the first character on a line. first or it doesn't count, periodt β
π BUGS π
The source code is not comprehensible.
that's it. that's the bug. the whole thing. ππ iykyk
okay that's the whole page!! go forth and telnet responsibly, bestie π«Ά
and yes, this little legend is from Linux NetKit (0.17), dated August 15, 1999 β an absolute vintage baddie πβ¨ she's old, she's classic, she's still serving πΈ
π¦ where this page comes from
- ubuntu jammy: telnet-ssl 0.17.41+0.2-3.3build2
- Copyright (c) 1983, 1990 The Regents of the University of California
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms