Telnet commands

You can use Telnet to access other systems. These Telnet commands will help you do that.

Start Telnet and establish a connection

Telnet is used from the command line, for example, the command prompt on Windows. Only one command is needed to start the client:

telnet

You can also connect directly without starting the client first. To do this, either specify the hostname or establish the connection via IP address:

telnet <hostname></hostname>
telnet 127.0.0.1

You will now be asked to enter the access data and will then be connected.

Telnet standard commands

The following overview shows the standard commands. Some of these can be extended with arguments and executed using the Telnet client:

Command Short command Description
?/help ? Opens the help menu
Close c Closes the current Telnet connection
display argument d Displays the various parameters for the current connection (port, terminal type, etc.)
environ argument   Defines the variables for the respective operating system environment
toggle argument   Determines how Telnet reacts to certain situations. The command changes the status from TRUE to FALSE or vice versa; using set or unset, the status can also be set directly ⁠— arguments are thus also valid for set/unset
Logout   Terminates the current Telnet session if the remote host supports the logout option
mode type   Sets the transmission type (text file, binary file)
open hostname o Establishes another connection to the selected host in addition to the existing one
Quit q Terminates the Telnet client including all active connections
send argument sen Sends selected typical Telnet strings to the host
set argument set Modifies the connection parameters
Unset u Loads the predefined connection parameters
Status st Shows whether the connection is active
Tip

Since Telnet is operated from the command line, you should also know other commands. Get to know Windows CMD commands to easily find your way around the command prompt.

Telnet command options

Some commands can be extended by arguments, which means that more options are available to you. Here are some important parameters:

Command Option Description
telnet -d Activates debug mode
  -a Attempts automatic login
  -n tracefile Opens tracefile to record appropriate information (see also “set tracefile”)
  -l user If the host supports environ, you will be logged in as the specified user.
  -e escape char Sets an escape character
  -E No character is recognized as escape character
  -x Attempts to activate encryption
mode character Disables LINEMODE
  Line Enables LINEMODE
  isig/-isig Enables/disables the TRAPSIG mode of LINEMODE
  edit/-edit Enables/disables the EDIT mode of LINEMODE
  softtabs/-softtabs Enables/disables the SOFT_TABS mode of LINEMODE
  litecho/-litecho Enables/disables the LIT_ECHO-Modus of LINEMODE
send abort Sends “Abort process” sequence
  Ao Sends “Abort output” sequence; the host flushes the output from itself to the client.
  ayt Sends “Are you there” sequence; the host can confirm with a response.
  brk Sends “Break” sequence
  ec Sends “Erase character” sequence; the host erases the last character entered
  el Sends Erase line sequence; the host erases the line that is being entered
  eof Sends “End of file” sequence
  eor Sends “End of record” sequence
  esc Sends the current escape character (see also “telnet -e”)
  ga Sends “Go ahead” sequence
  getstatus Requests the host to discard any input that has not yet been processed
  ? Provides information about the send command
set/unset echo value Determines whether characters entered should also be displayed
(value can be TRUE/FALSE or a special character) eof value Enables the “End of file” character (see also “send eof”)
  erase value Enables erase character (see also “send ec”); works only in localchars mode (see also “toggle localchars”)
  escape value Enables escape character (see also “telnet -e”)
  flushoutput value Enables abort output character (see also “send ao”); works only in localchars mode (see also “toggle localchars”)
  lnext value Enables “lnext” characters
  quit value Enables “break” characters (see also “send brk”); works only in localchars mode (see also toggle localchars)
  reprint value Enables “reprint” character
  start value Enables “start” character; only if TOGGLE-FLOW-CONTROL is enabled
  stop value Activates “stop” character; only if TOGGLE-FLOW-CONTROL is activated
  worderase value Enables “worderase” characters
environ define variable value Assigns a value to a variable; values can be enclosed in single or double quotes.
  undefine variable Deletes the specified variable
  export variable Exports the specified variable
  unexport variable Specifies that the specified variable may only be exported when Telnet is specifically requested to do so
  list Lists all variables; * character indicates whether the variable is exported automatically.
  ? Provides information about the send command
toggle autosynch If both autosynch and localchars are active, an additional “synch” sequence is sent when the quit character is sent (see also “set quit”)
(Initial state is TRUE) binary Enables/disables “binary” option on input and output
  inbinary Enables/disables “binary” option at input
  outbinary Enables/disables binary option on output
  crlf TRUE: carriage return is set to <CR><LF>
  crmod FALSE: carriage return is set to <CR><NUL> (FALSE is the normal state here)
  debug Switches the state of the “carriage return” mode
  localchars Switches the state of the “Socket debug” mode (FALSE is the normal state here)

For more Telnet commands and options, as well as detailed documentation, check out the Telnet Man Page.

Tip

If you don’t really know the remote protocol yet, it’s worth taking a look at our detailed article on the subject ⁠— telnet. The article also explains how to enable Telnet in Windows.

Was this article helpful?
We use cookies on our website to provide you with the best possible user experience. By continuing to use our website or services, you agree to their use. More Information.
Page top