TELNET(1)
okay bestie, buckle up โ this is TELNET(1) from the General Commands Manual, and it's a long one so it comes in four parts. this is part one. hydrate first ๐
โจ NAME โจ
telnet โ user interface to the TELNET protocol. that's the whole vibe ๐ซถ
๐ SYNOPSIS ๐
telnet [-468ELadr] [-S tos] [-b address] [-e escapechar] [-l user]
[-n tracefile] [host [port]]
๐ DESCRIPTION ๐
okay so the telnet command is what you use for interactive communication with another host using the TELNET protocol. it starts you in command mode, where it prints a lil telnet prompt ("telnet> "). and if you invoke telnet with a host argument, it just performs an open command implicitly, no big deal, it's giving main character energy. see the description below ๐
๐ Options ๐
-4โ force IPv4 address resolution. we're being specific ๐-6โ force IPv6 address resolution. also specific, also iconic.-8โ request 8-bit operation. this causes an attempt to negotiate the TELNET BINARY option for both input and output. by defaulttelnetis not 8-bit clean, so this is you asking for the upgrade โจ-Eโ disables the escape character functionality; that is, it sets the escape character to ``no character''. obsessed, no notes.-Lโ specifies an 8-bit data path on output. this causes the TELNET BINARY option to be negotiated on just output. only output, bestie.-aโ attempt automatic login. currently, this sends the user name via theUSERvariable of the NEW-ENVIRON option if the remote system supports it. the username is retrieved viagetlogin(3).-baddress โ usebind(2)on the local socket to bind it to a specific local address.-dโ sets the initial value of the debug toggle to TRUE. debug girlies rise.-rโ emulaterlogin(1). in this mode, the default escape character is a tilde. also, the interpretation of the escape character is changed: an escape character followed by a dot causestelnetto disconnect from the remote host. a^Zinstead of a dot suspendstelnet, and a^](the default telnet escape character) generates a normal telnet prompt. these codes are accepted only at the beginning of a line. iykyk.-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. ๐-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.-ntracefile โ opens tracefile for recording trace information. see theset tracefilecommand 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. teamwork fr fr ๐ค
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 โ sneaky ๐).
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 you can be lazy about typing. we love that ๐
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.
note: the current version of telnet does not support authentication. ๐ญ not me finding out like this.
closeโ close the connection to the remote host, if any, and return to command mode.displayargument ... โ display all, or some, of thesetandtogglevalues (see below).encryptargument ... โ theencryptcommand controls the TELNET ENCRYPT protocol option. iftelnetwas compiled without encryption, theencryptcommand will not be supported.
valid arguments are as follows:
disabletype [input|output] โ disable the specified type of encryption. if you do not specifyinputoroutput, encryption of both is disabled. to obtain a list of available types, use ``encrypt disable ?''.enabletype [input|output] โ enable the specified type of encryption. if you do not specifyinputoroutput, encryption of both is enabled. to obtain a list of available 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 specifyinputoroutput, 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 specifyinputoroutput, encryption of both is stopped.typetype โ sets the default type of encryption to be used with laterencrypt start'' orencrypt stop'' commands.
note: the current version of telnet does not support encryption. ๐ again!! the audacity.
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. dramatic exit, honestly ๐modetype โ 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. consent-based mode switching, we respect it โจ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 understand the LINEMODE option, then attempt to enter โold-line-by-lineโ mode.
okay so back to the mode command โ here are the lil modes you can flip, bestie ๐
isig(-isig) โ try to enable (or disable) theTRAPSIGmode of theLINEMODEoption. This requires that theLINEMODEoption be enabled, fr.edit(-edit) โ try to enable (or disable) theEDITmode of theLINEMODEoption. This also requiresLINEMODEto be enabled.softtabs(-softtabs) โ try to enable (or disable) theSOFT_TABmode of theLINEMODEoption. NeedsLINEMODEenabled.litecho(-litecho) โ try to enable (or disable) theLIT_ECHOmode of theLINEMODEoption. Also needsLINEMODEenabled.?โ prints out help information for themodecommand. โจ
open ๐
open host [[-l] user][- port]
Open a connection to the named host. If you don't specify a port number, telnet will try to contact a telnet daemon at the standard port (23). The host specification may be a host name or IP address. You can use the -l option 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. Hostnames 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. Bye bestie!
send ๐ก
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 theTELNET ABORT(Abort Processes) sequence.aoโ Sends theTELNET 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 theTELNET AYT(Are You There?) sequence, to which the remote system may or may not choose to respond.brkโ Sends theTELNET BRK(Break) sequence, which may have significance to the remote system.ecโ Sends theTELNET EC(Erase Character) sequence, which should cause the remote system to erase the last character entered.elโ Sends theTELNET EL(Erase Line) sequence, which should cause the remote system to erase the line currently being entered.eofโ Sends theTELNET EOF(End Of File) sequence.eorโ Sends theTELNET EOR(End of Record) sequence.escapeโ Sends the current telnet escape character.gaโ Sends theTELNET GA(Go Ahead) sequence, which likely has no significance to the remote system.getstatusโ If the remote side supports theTELNET STATUScommand,getstatuswill send the subnegotiation to request that the server send its current option status.ipโ Sends theTELNET IP(Interrupt Process) sequence, which should cause the remote system to abort the currently running process.nopโ Sends theTELNET NOP(No Operation) sequence.suspโ Sends theTELNET SUSP(Suspend Process) sequence.synchโ Sends theTELNET SYNCHsequence. 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 a4.2BSDsystem -- if it doesn't work, a lower caseโrโmay be echoed on the terminal).do cmd,dont cmd,will cmd,wont cmdโ Sends theTELNET DO cmdsequence.cmdcan be either a decimal number between0and255, or a symbolic name for a specific TELNET command.cmdcan also be eitherhelpor?to print out help information, including a list of known symbolic names.?โ Prints out help information for thesendcommand. ๐ซถ
set / unset ๐๏ธ
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 variable. 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 interrogated 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 command may be explicitly set or unset.
aytโ Iftelnetis inlocalcharsmode, orLINEMODEis enabled, and the status character is typed, aTELNET AYTsequence 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โ Iftelnetis operating inLINEMODEorโ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 theeofcharacter is taken to be the terminal'seofcharacter.eraseโ Iftelnetis inlocalcharsmode (seetoggle localcharsbelow), and iftelnetis operating inโcharacter at a timeโmode, then when this character is typed, aTELNET ECsequence (seesend ecabove) is sent to the remote system. The initial value for theerasecharacter is taken to be the terminal'serasecharacter.escapeโ This is the telnet escape character (initiallyโ^]โ) which causes entry into telnet command mode (when connected to a remote system).flushoutputโ Iftelnetis inlocalcharsmode (seetoggle localcharsbelow) and theflushoutputcharacter is typed, aTELNET AOsequence (seesend aoabove) is sent to the remote host. The initial value for the flush character is taken to be the terminal's flush character.forw1,forw2โ IfTELNETis operating inLINEMODE, these are the characters that, when typed, cause partial lines to be forwarded to the remote system. The initial value for the forwarding characters are taken from the terminal'seolandeol2characters.interruptโ Iftelnetis inlocalcharsmode (seetoggle localcharsbelow) and the interrupt character is typed, aTELNET IPsequence (seesend ipabove) is sent to the remote host. The initial value for the interrupt character is taken to be the terminal'sintrcharacter.killโ Iftelnetis inlocalcharsmode (seetoggle localcharsbelow), and iftelnetis operating inโcharacter at a timeโmode, then when this character is typed, aTELNET ELsequence (seesend elabove) is sent to the remote system. The initial value for thekillcharacter is taken to be the terminal'skillcharacter.lnextโ Iftelnetis operating inLINEMODEorโold line by lineโmode, then this character is taken to be the terminal'slnextcharacter. The initial value for thelnextcharacter is taken to be the terminal'slnextcharacter.quitโ Iftelnetis inlocalcharsmode (seetoggle localcharsbelow) and thequitcharacter is typed, aTELNET BRKsequence (seesend brkabove) is sent to the remote host. The initial value for thequitcharacter is taken to be the terminal'squitcharacter.
reprintโ when telnet is running in LINEMODE or in "old line by line" mode, this char is treated as your terminal's reprint character. The initial value for the reprint character is taken to be the terminal's reprint character. ๐ซrloginโ this is the rlogin mode escape character. Set it and boom, rlogin mode is on, exactly like using thercommand-line option (q.v.). ๐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. (yes bestie, it says kill character right there, not me, the page is just like that ๐)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. (same little quirk, love that for us ๐)suspโ if telnet is in localchars mode, or LINEMODE is enabled, and you type the suspend character, 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โ the file where the output goes whennetdataor option tracing is TRUE. Set it to-and all that tracing info gets written to standard output instead (which is the default, fyi). ๐worderaseโ if telnet is operating in LINEMODE or "old line by line" mode, 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 legalset(unset) commands. iykyk, it's the cheat sheet. ๐
slc stateโ theslccommand (short for Set Local Characters, obvi) sets or changes the state of the special characters whenever the TELNET LINEMODE option has been enabled. And what even is a special character? It's a character that gets mapped to TELNET command sequences (likeiporquit) or to line editing characters (likeeraseandkill). By default, the local special characters are exported. ๐ฆcheckโ verify the current settings for the current special characters. The remote side gets asked to send over all its current special character settings, and if anything disagrees with the local side, the local side switches to the remote value. vibe check, but make it protocol. ๐ธexportโ switch to the local defaults for the special characters. Those local default characters are the ones belonging to your local terminal at the moment telnet was started. ๐importโ switch to the remote defaults for the special characters. Those remote default characters are the ones belonging to the remote system at the moment the TELNET connection was established. ๐?โ prints out help information for theslccommand. ๐
statusโ shows the current status of telnet. That means the name of the remote host, if there is one, plus whatever mode you're currently in. main character check-in energy. ๐toggle arguments ...โ flips (between TRUE and FALSE) a bunch of flags that control how telnet reacts to events. You can also set these flags explicitly to TRUE or FALSE with thesetandunsetcommands. Multiple flags at once? Absolutely, toggle away. And you can peek at the state of these flags with thedisplaycommand. Here's the full roster of valid flags: โญauthdebugโ turns on debugging for the authentication code. Heads up: this flag only exists if authentication support is enabled. ๐autoflushโ ifautoflushandlocalcharsare both TRUE, then when theaoorquitcharacters get recognized (and transformed into TELNET sequences; seesetabove for the deets), telnet straight up 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)). ๐ฐautodecryptโ when the TELNET ENCRYPT option is negotiated, by default the actual encryption (decryption) of the data stream does not start automatically. Theautoencrypt(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 tries to use it to do automatic authentication. If the TELNET AUTHENTICATION option is not supported, your login name gets propagated using the TELNET NEW-ENVIRON option instead. Setting this flag is the same thing as specifying theaoption to theopencommand or on the command line. ๐ชชautosynchโ ifautosynchandlocalcharsare both TRUE, then when you type either theintrorquitcharacters (seesetabove for descriptions of theintrandquitcharacters), the resulting telnet sequence that gets sent is followed by the TELNET SYNCH sequence. This procedure should cause the remote system to start throwing away all previously typed input until both of those 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. ๐ฏ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 get sent as<CR><LF>. If it's FALSE, then carriage returns get send as<CR><NUL>. The initial value for this toggle is FALSE. โฉ๏ธcrmodโ toggles carriage return mode. When this mode is enabled, most carriage return characters received from the remote host get mapped into a carriage return followed by a line feed. This mode does not affect the characters you type, only the ones coming back from the remote host. And honestly? This mode is not very useful unless the remote host only ever 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, so if that's not you, mind your business ๐ ). 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 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. And if LINEMODE has ever been enabled, thenquitis sent asabort, andeofandsuspare 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 (the stuff having to do with telnet options). The initial value for this toggle is FALSE. โ๏ธprettydumpโ when thenetdatatoggle is enabled, ifprettydumpis also enabled the output from thenetdatacommand gets formatted in a much more user-readable way. Spaces are put between each character in the output, and the beginning of telnet escape sequences are preceded by a'*'to help you locate them. so iconic of it. ๐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. ๐ฅ๏ธ
verbose_encrypt
When the verbose_encrypt toggle is TRUE, TELNET spills the tea ๐ฌ โ it prints out a message every single time encryption is enabled or disabled. The initial value for this toggle is FALSE, bestie. It's giving quiet luxury. ๐
Heads up: this flag only exists if encryption support is available. No encryption build, no flag, no drama. ๐
?
Displays the legal toggle commands. Basically the toggle list's own little help menu โ ask nicely and it shows you the whole lineup. โจ
z
Suspend telnet. ๐ด Just... pause it. Put it in timeout.
Real talk though: this command only works when the user is using csh(1). Any other shell and it's simply not happening, no cap. ๐ญ
! [command]
Execute a single command in a subshell on the local system. ๐ฅ๏ธ If command is omitted, then an interactive subshell is invoked. So ! with stuff after it runs one thing locally, and bare ! drops you into a whole interactive subshell. Yes bestie, the local system, not the remote one โ read it again, it matters. ๐ซถ
? [command]
Get help. ๐ With no arguments, telnet prints a help summary. If a command is specified, telnet will print the help information for just that command. So like ? open gives you the lore on open specifically and nothing else. Iconic. ๐
๐ ENVIRONMENT ๐
Telnet uses at least the HOME, SHELL, DISPLAY, and TERM environment variables. Other environment variables may be propagated to the other side via the TELNET NEW-ENVIRON option. ๐
๐ FILES ๐
/etc/telnetrcโ global telnet startup values~/.telnetrcโ user customized telnet startup values
๐ HISTORY ๐
The Telnet command appeared in 4.2BSD. Vintage. Old money. Literally a classic. ๐ฐ๏ธโจ
๐ NOTES ๐
On some remote systems, echo has to be turned off manually when in โold line by lineโ mode. ๐ So if things look weird, that's why โ go turn it off yourself.
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. ๐ฆ Position matters, fr fr.
๐ BUGS ๐
The source code is not comprehensible. That's it. That's the whole bug report. Not me opening that C file and immediately closing it. ๐ญ๐
And that's the whole page, bestie โ this one's from Linux NetKit (0.17), dated August 15, 1999, and it's TELNET(1). Slay. ๐๐
๐ฆ where this page comes from
- ubuntu jammy: telnet 0.17-44build1 ยท BSD-4-Clause
- 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