telnet(1)
๐ telnet(1) โ the User's Reference Manual ๐
okay bestie, this is the telnet(1) page from the User's Reference Manual ๐โจ it's the user interface to the TELNET protocol, so it's how you talk to another machine over the network ๐ซถ
๐ธ NAME ๐ธ
telnet is a user interface to the TELNET protocol ๐
๐ฆ SYNOPSIS ๐ฆ
telnet [options ...] [host [port]]
โจ DESCRIPTION โจ
okay so the telnet command is how you communicate with another host using the TELNET protocol ๐ก if you run telnet with no host argument, it drops you into command mode, and you'll know because the prompt says telnet> ๐ in this mode it accepts and runs the commands listed below. if you DO give it arguments, it just runs an open command with those arguments, so it's giving efficiency ๐ฅ
๐ OPTIONS ๐
-4,--ipv4โ connect to hosts using IPv4 ๐-6,--ipv6โ connect to hosts using IPv6 ๐-8,--binaryโ sets up an 8-bit data path โจ this tries to negotiate the TELNET BINARY option on both input and output, so both directions get the binary treatment ๐-L,--binary-outputโ sets up an 8-bit data path on output only ๐ฆ this makes the BINARY option get negotiated on output-e,--escape escape-charโ sets the starting telnet escape character toescape-char๐ช if you leaveescape-charout, there won't be an escape character at all ๐-E,--no-escapeโ stops ANY character from being recognized as an escape character, no exceptions ๐ซ-a,--loginโ tries automatic login ๐ right now this sends your user name through theUSERvariable of the ENVIRON option, but only if the remote system supports it ๐ the name it uses is whatevergetlogin(2)returns, as long as that agrees with your current user ID; otherwise it uses the name tied to your user ID-K,--no-loginโ no automatic login to the remote system, bestie, you'll have to do it yourself ๐ โโ๏ธ-l,--user userโ when you connect, if the remote system understands the ENVIRON option,usergets sent over as the value for theUSERvariable ๐ this option implies-a, and you can also use it with theopencommand-n,--trace tracefileโ openstracefileso it can record trace information ๐ see theset tracefilecommand below for more-r,--rloginโ gives you a user interface that's similar torlogin(1)๐ in this mode the escape character is set to the tilde (~) character, unless you change it with-e-c,--no-rcโ turns off reading of your.telnetrcfile ๐ (check out thetoggle skiprccommand on this page for the deets)-d,--debugโ sets the starting value of the debug toggle to TRUE ๐-x,--encryptโ turns on encryption of the data stream, if it's possible ๐-X,--disable-auth atypeโ disables theatypetype of authentication ๐ซ-k,--realm realmโ if you're using Kerberos authentication, this asks telnet to get tickets for the remote host in realmrealm, instead of the remote host's realm as figured out bykrb_realmofhost(3)๐hostโ the official name, an alias, or the Internet address of a remote host ๐ธportโ a port number (basically the address of an application) ๐ง if you don't specify one, the default telnet port gets used
๐ OPERATION ๐
๐ rlogin mode ๐
okay so when you're in rlogin mode, a line of the form ~. disconnects you from the remote host ๐ (the ~ is the telnet escape character). the line ~^Z suspends your telnet session, and the line ~^] escapes you to the normal telnet escape prompt ๐ซถ
๐ LINEMODE and input modes ๐
once a connection is open, telnet will try to enable the TELNET LINEMODE option โจ if that fails, telnet falls back 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 happens on your local system, but the remote system is the one in charge ๐ if input editing or character echoing needs to be turned off, the remote system tells you about it. it also relays any changes to special characters that happen on the remote side, so those changes can take effect locally too ๐ฅ
in "character at a time" mode, most of the text you type gets sent to the remote host right away for processing โก
in "old line by line" mode, all text is echoed locally, and (normally) only completed lines get sent to the remote host ๐ the "local echo character" (starts out as ^E) lets you turn local echo on and off ๐ this is mostly used for typing in passwords without them showing up on screen ๐
โ ๏ธ if LINEMODE is enabled, OR thelocalcharstoggle is TRUE (which is the default for "old line by line", see below), your quit, intr, and flush characters get trapped locally and sent to the remote side as TELNET protocol sequences ๐ if LINEMODE has EVER been enabled, your susp and eof get sent as TELNET protocol sequences too, and quit is sent as a TELNET ABORT instead of BREAK ๐ญ there are options (seetoggle autoflushandtoggle autosynchbelow) that make this action flush any later output to the terminal (until the remote host acknowledges the TELNET sequence) and flush previous terminal input (for quit and intr)
๐ง command mode ๐ง
while you're connected to a remote host, you can get into telnet command mode by typing the telnet "escape character" (starts out as ^]) โจ once you're in command mode, the normal terminal editing conventions are available to you ๐
the following telnet commands are available ๐ธ you only need to type enough of each command to uniquely identify it (this goes for arguments to the mode, set, toggle, unset, slc, environ, and display commands too) ๐
auth argument ... ๐
the auth command messes with the information sent through the TELNET AUTHENTICATE option ๐ these are the valid arguments:
disable typeโ disables the specified type of authentication ๐ซ to see a list of available types, useauth disable ?enable typeโ enables the specified type of authentication โ to see a list of available types, useauth enable ?statusโ lists the current status of the various types of authentication ๐
close ๐ช
closes a TELNET session and sends you back to command mode ๐ซถ
display argument ... ๐ฅ๏ธ
displays all, or some, of the set and toggle values (see below) โจ
encrypt argument ... ๐
the encrypt command messes with the information sent through the TELNET ENCRYPT option ๐
โ ๏ธ heads up: because of export controls, the TELNET ENCRYPT option is NOT supported outside of the United States and Canada ๐ no cap
these are the valid arguments for encrypt:
disable type [input|output]โ disables the specified type of encryption ๐ซ if you leave outinputandoutput, both get disabled. to see a list of available types, useencrypt disable ?enable type [input|output]โ enables the specified type of encryption โ if you leave outinputandoutput, both get enabled. to see a list of available types, useencrypt enable ?inputโ the same asencrypt start input๐ฅ-inputโ the same asencrypt stop input๐คoutputโ the same asencrypt start output๐ค-outputโ the same asencrypt stop output๐ฅstart [input|output]โ tries to start encryption ๐ if you leave outinputandoutput, both get enabled. to see a list of available types, useencrypt enable ?statusโ lists the current status of encryption ๐stop [input|output]โ stops encryption ๐ if you leave outinputandoutput, encryption is stopped on both input and outputtype typeโ sets the default type of encryption to be used with laterencrypt startorencrypt stopcommands ๐ฏ
environ arguments... ๐
the environ command is for messing with the variables that can be sent through the TELNET ENVIRON option โจ the starting set of variables comes from your user's environment, and only the DISPLAY and PRINTER variables get exported by default ๐ the USER variable gets exported too if you use the -a or -l options ๐
these are the valid arguments for environ:
define variable valueโ defines the variablevariableto have a value ofvalue๐ธ anything defined with this command gets exported automatically ๐ฆ the value can be wrapped in single or double quotes so tabs and spaces can be includedundefine variableโ removesvariablefrom the list of environment variables ๐๏ธexport variableโ marks the variablevariableto be exported to the remote side ๐คunexport variableโ marks the variablevariableto NOT be exported, unless the remote side explicitly asks for it ๐ โโ๏ธlistโ lists the current set of environment variables ๐ the ones marked with a*will be sent automatically, and the other variables will only be sent if they're explicitly requested ๐?โ prints out help information for theenvironcommand ๐
๐ logout
okay so logout sends the TELNET LOGOUT option to the remote side ๐ชโจ It's basically a close vibe, BUT if the remote side doesn't support LOGOUT, nothing happens ๐ If it does support it, this should make the remote side close the TELNET connection ๐ And if the remote side can also suspend your session so you can jump back in later, logout tells it to end the session right away. no cap, it's giving finality ๐ญ
๐ mode type
okay this one is so good ๐ฅ mode takes a type, and which types you get depends on what state your TELNET session is in ๐ฆ You ask the remote host for permission to switch into the mode you picked. If the host can handle that mode, you're in โจ
characterโ disables the TELNET LINEMODE option. If the remote side doesn't understand LINEMODE at all, you get "character at a time" mode instead ๐lineโ enables the TELNET LINEMODE option. If the remote side doesn't understand LINEMODE, it tries "old-line-by-line" mode ๐ธisig(-isig) โ tries to turn the TRAPSIG mode of LINEMODE on (or off with-isig) ๐ง This only works if LINEMODE is already enablededit(-edit) โ tries to turn the EDIT mode of LINEMODE on (or off with-edit) ๐ Same deal: LINEMODE has to be enabled firstsofttabs(-softtabs) โ tries to turn the SOFT_TAB mode of LINEMODE on (or off with-softtabs) ๐ LINEMODE must already be onlitecho(-litecho) โ tries to turn the LIT_ECHO mode of LINEMODE on (or off with-litecho) ๐ LINEMODE must be enabled for this one too?โ prints out help info for themodecommand ๐ซถ
๐ธ open
open host [[-l] user][- port]
okay this is the big one, bestie ๐ open connects you to the named host โจ If you don't give a port, telnet tries the default TELNET server port ๐ฆ The host can be a host name (check out hosts(5)) or an Internet address in "dot notation" (see inet(3)) ๐
The [-l] option lets you pass a user name to the remote system through the ENVIRON option ๐ Heads up: when you connect to a non-standard port, telnet skips the automatic starting of TELNET options ๐ But if you put a minus sign in front of the port number, the initial option negotiation does happen ๐ญ
Once you're connected, telnet opens the file .telnetrc in your home directory ๐ Lines starting with a # are comments and get ignored ๐ Blank lines also get skipped ๐ซง A line that starts with no whitespace is the start of a machine entry, and the first thing on that line is the name of the machine you're connecting to ๐ฅ๏ธ The rest of that line, plus any lines after it that start with whitespace, are treated as telnet commands and get run just like you typed them at the telnet command prompt ๐งโจ
๐ quit
quit closes any open TELNET session and exits telnet ๐ An end of file (in command mode) does the same thing, so it closes the session and exits too ๐
๐จ send
send arguments
send fires off one or more special character sequences to the remote host ๐ You can pass more than one argument at a time, and these are your options:
abortโ sends the TELNET ABORT (Abort processes) sequence ๐ฅaoโ sends the TELNET AO (Abort Output) sequence ๐ This should make the remote system flush all its output to your terminalaytโ sends the TELNET AYT (Are You There) sequence ๐ The remote system may or may not answer, no pressure ๐brkโ sends the TELNET BRK (Break) sequence ๐ซจ It might mean something to the remote systemecโ sends the TELNET EC (Erase Character) sequence โ๏ธ This should make the remote system erase the last character you enteredelโ sends the TELNET EL (Erase Line) sequence ๐งน This should make the remote system erase the line you're currently typingeofโ sends the TELNET EOF (End Of File) sequence ๐eorโ sends the TELNET EOR (End of Record) sequence ๐ผescapeโ sends the current telnet escape character (starts out as^) ๐ฆgaโ sends the TELNET GA (Go Ahead) sequence ๐ฆ It probably doesn't mean anything to the remote system, lowkeygetstatusโ if the remote side supports the TELNET STATUS command, this sends the subnegotiation asking the server for its current option status ๐ipโ sends the TELNET IP (Interrupt Process) sequence โ This should make the remote system abort whatever process is running right nownopโ sends the TELNET NOP (No OPeration) sequence ๐ดsuspโ sends the TELNET SUSP (SUSPend process) sequence โธ๏ธsynchโ sends the TELNET SYNCH sequence ๐งผ This makes the remote system throw away all the input it has been sent but hasn't read yet. It goes out as TCP urgent data, and it might not work if the remote system is a 4.2BSD system. If it doesn't work, you might see a lower case โrโ echoed on your terminal ๐do cmd,dont cmd,will cmd,wont cmdโ sends the TELNET DO, DONT, WILL, or WONT sequence for cmd ๐ The cmd can be a decimal number from 0 to 255, or a symbolic name for a specific TELNET command. You can also passhelpor?as the cmd to print help info, including a list of the known symbolic names ๐?โ prints out help info for thesendcommand ๐
โ๏ธ set and unset
set argument value
unset argument value
okay so set turns any one of a bunch of telnet variables into a specific value, or into TRUE โจ The special value off turns off the function tied to that variable, and it does the same thing as unset ๐ซถ unset disables the specified functions, or sets them to FALSE ๐ You can check what a variable's value is with the display command ๐ The variables that can be set or unset (but not toggled) are listed below. You can also explicitly set or unset any of the toggle variables using set and unset ๐
aytโ if TELNET is in localchars mode, or LINEMODE is enabled, and you type the status character, a TELNET AYT sequence (seesend aytabove) gets sent to the remote host ๐ The starting value for the "Are You There" character is your terminal's status characterechoโ this is the character (starts out as โ^Eโ) that, when you're in "line by line" mode, switches between local echoing of what you type (normal stuff) and not echoing it at all (handy for typing a password ๐)eofโ if telnet is running in LINEMODE or "old line by line" mode, typing this character as the first thing on a line sends it to the remote system ๐ The starting value is your terminal's eof charactereraseโ if telnet is in localchars mode (seetoggle localcharsbelow) and it's running in "character at a time" mode, typing this character sends a TELNET EC sequence (seesend ecabove) to the remote system โ๏ธ The starting value is your terminal's erase characterescapeโ this is the telnet escape character (starts out as โ^[โ) that jumps you into telnet command mode while you're connected to a remote system ๐ฆflushoutputโ if telnet is in localchars mode (seetoggle localcharsbelow) and you type the flushoutput character, a TELNET AO sequence (seesend aoabove) gets sent to the remote host ๐ The starting value is your terminal's flush characterforw1,forw2โ if TELNET is running in LINEMODE, these are the characters that, when typed, forward partial lines to the remote system ๐ Their starting values come from your terminal's eol and eol2 charactersinterruptโ if telnet is in localchars mode (seetoggle localcharsbelow) and you type the interrupt character, a TELNET IP sequence (seesend ipabove) gets sent to the remote host โ The starting value is your terminal's intr character
Okay so the set command keeps going, bestie, and it's giving control freak energy ๐
killโ ๐ช If telnet is in localchars mode (see togglelocalcharsbelow) and it's running in "character at a time" mode, typing this character sends a TELNET EL sequence (seesend elabove) to the remote system. Its starting value is whatever your terminal's kill character is.lnextโ โ๏ธ If telnet is in LINEMODE or "old line by line" mode, this character is treated as the terminal's lnext character. Its starting value is also your terminal's lnext character.quitโ ๐ If telnet is in localchars mode (see togglelocalcharsbelow) and you type the quit character, a TELNET BRK sequence (seesend brkabove) gets sent to the remote host. Its starting value is your terminal's quit character.reprintโ ๐ If telnet is in LINEMODE or "old line by line" mode, this character is treated as the terminal's reprint character. Its starting value is your terminal's reprint character.rloginโ ๐ง This is the rlogin escape character. Once it's set, the normal TELNET escape character gets ignored unless it's preceded by this character at the start of a line. Typing this at the start of a line followed by a.closes the connection, and followed by^Zit suspends the telnet command. Starts out disabled.startโ โถ๏ธ If the TELNET TOGGLE-FLOW-CONTROL option has been enabled, this character is treated as 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, this character is treated as 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 you type the suspend character, a TELNET SUSP sequence (seesend suspabove) gets sent to the remote host. Its starting value is your terminal's suspend character.tracefileโ ๐ This is the file where output fromnetdataor option tracing (when set to TRUE) gets written. If it's set to-, tracing info goes to standard output, which is the default.worderaseโ ๐ซง If telnet is in LINEMODE or "old line by line" mode, this character is treated as the terminal's worderase character. Its starting value is your terminal's worderase character.?โ ๐ Shows you the legal set (unset) commands.
โจ 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 is enabled. Special characters are the ones that get mapped to TELNET command sequences (like ip or quit) or line editing characters (like erase and kill). By default, the local special characters get exported ๐ซถ
checkโ ๐ Double-checks the current settings for the current special characters. The remote side gets asked to send all of its special character settings, and if anything doesn't match the local side, the local side switches over to the remote value.exportโ ๐ค Switches to the local defaults for the special characters. Those are the ones your local terminal had when telnet started.importโ ๐ฅ Switches to the remote defaults for the special characters. Those are the ones the remote system had when the TELNET connection was set up.?โ ๐ Prints out help info for theslccommand.
๐ก status
Shows you the current status of telnet, bestie! It tells you which peer you're connected to and what mode you're in ๐
๐๏ธ toggle arguments ...
Toggle (flipping between TRUE and FALSE) lets you flip all kinds of flags that control how telnet responds to events. You can explicitly set these flags to TRUE or FALSE with the set and unset commands listed above. You can pass more than one argument at once, and you can check the state of these flags with the display command. Here are the valid arguments:
authdebugโ ๐ต๏ธ Turns on debugging info for the authentication code.autoflushโ ๐ Ifautoflushandlocalcharsare both TRUE, then when theaoorquitcharacters are recognized (and turned into TELNET sequences; seesetabove for the details), telnet won't display any data on your terminal until the remote system acknowledges (via the TELNET TIMING MARK option) that it has processed those sequences. This toggle starts out TRUE if the terminal user hasn't runstty noflsh, and FALSE otherwise (see stty(1)).autodecryptโ ๐ When the TELNET ENCRYPT option gets negotiated, the actual encryption (decryption) of the data stream doesn't kick in automatically by default. Theautoencrypt(autodecrypt) command says that encryption of the output (input) stream should be turned on as soon as possible.
โ ๏ธ Note: Because of export controls, the TELNET ENCRYPT option isn't supported outside the United States and Canada.
autologinโ ๐ชช If the remote side supports the TELNET AUTHENTICATION option, telnet tries to use it for automatic authentication. If AUTHENTICATION isn't supported, your login name gets passed along through the TELNET ENVIRON option. This command does the same thing as specifying an-aoption on theopencommand.autosynchโ ๐ Ifautosynchandlocalcharsare both TRUE, then when either theintrorquitcharacter is typed (seesetabove for descriptions of those), the resulting TELNET sequence gets followed by the TELNET SYNCH sequence. This should make the remote system start throwing away all previously typed input until both TELNET sequences have been read and acted on. This toggle starts out FALSE.binaryโ ๐ค Enables or disables the TELNET BINARY option on both input and output.inbinaryโ ๐ฅ Enables or disables the TELNET BINARY option on input.outbinaryโ ๐ค Enables or disables the TELNET BINARY option on output.crlfโ โฉ๏ธ If this is TRUE, carriage returns get sent as<CR><LF>. If it's FALSE, carriage returns get sent as<CR><NUL>. This toggle starts out 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 doesn't touch what you type, only what's received from the remote host. It's not super useful unless the remote host only sends carriage return and never line feed. This toggle starts out FALSE.debugโ ๐ Toggles socket level debugging, which is only useful to the super user ๐ This toggle starts out FALSE.encdebugโ ๐ Turns on debugging info for the encryption code.localcharsโ ๐ When this is TRUE, the flush, interrupt, quit, erase, and kill characters (seesetabove) get caught locally and swapped for (hopefully) the right TELNET control sequences:ao,ip,brk,ec, andel, respectively (seesendabove). The starting value is TRUE in "old line by line" mode and FALSE in "character at a time" mode. If the LINEMODE option is turned on, the value oflocalcharsgets ignored and is treated as always TRUE. And if LINEMODE has ever been enabled, then quit is sent asabort, and eof and suspend are sent aseofandsusp(seesendabove). ๐netdataโ ๐ Flips the display of all network data on and off, shown in hexadecimal. It starts out FALSE.optionsโ ๐ง Flips the display of some of the behind-the-scenes TELNET protocol stuff (the TELNET options stuff). It starts out FALSE.prettydumpโ ๐ Whennetdatais on, turningprettydumpon makes thenetdataoutput way easier to read. There are spaces between every character, and any TELNET escape sequence gets a*in front so you can spot them easily. ๐ฆskiprcโ ๐ Whenskiprcis TRUE, TELNET skips reading the.telnetrcfile in your home directory whenever it opens a connection. It starts out FALSE.termdataโ ๐ Flips the display of all terminal data on and off, in hexadecimal. It starts out FALSE.verbose_encryptโ ๐ When this is TRUE, TELNET prints a message every time encryption gets turned on or off. It starts out FALSE.
โ ๏ธ Heads up, bestie! Because of export controls, data encryption is not supported outside of the United States and Canada. ๐ญ
?โ ๐ Shows you the legal toggle commands.zโ ๐ด Suspends telnet. This only works when you're usingcsh(1).! [command]โ ๐ Runs a single command in a subshell on the local system. If you leavecommandout, you get an interactive subshell instead.? [command]โ ๐ Help, obviously! With no arguments, telnet prints a help summary. If you name a command, you get the help info for just that one. ๐ง
๐ ENVIRONMENT ๐
okay so telnet uses at least the HOME, SHELL, DISPLAY, and TERM environment variables. โจ Other environment variables can get passed along to the other side through the TELNET ENVIRON option. Cute, right? ๐
๐ FILES ๐
~/.telnetrcโ your personal telnet startup values, customized just for you ๐
๐ HISTORY ๐
The telnet command first showed up in 4.2BSD. Iconic. ๐
๐ NOTES ๐
okay bestie, on some remote systems you have to turn echo off by hand when you're in "old line by line" mode. Annoying, but you got this! ๐
In "old line by line" mode or LINEMODE, the terminal's eof character only gets recognized (and sent to the remote system) when it's the very first character on a line. So no sneaking it in halfway through, fr fr. ๐
Thanks for sticking with me through the whole telnet glow-up, bestie! ๐ซถ This page came from GNU Network Utilities, dated February 9, 2019, and it's all about telnet(1). Periodt. ๐โจ
๐ฆ where this page comes from
- debian trixie: inetutils-telnet 2:2.6-3+deb13u3
- ubuntu questing: inetutils-telnet 2:2.6-1ubuntu3
- ubuntu questing: inetutils-telnet 2:2.6-1ubuntu3.2
- ubuntu resolute: inetutils-telnet 2:2.7-2ubuntu1
- ubuntu resolute: inetutils-telnet 2:2.7-2ubuntu1.1
- ubuntu stonking: inetutils-telnet 2:2.8-2ubuntu1
- Copyright (c) 1983, 1990, 1993 The Regents of the University of California. All rights reserved
- ๐ girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms