Skip to content


Telnet (Teletype Network)

Telnet is a network protocol used to virtually access a computer and to provide a two-way, collaborative and text-based communication channel between two machines.

It follows a user command Transmission Control Protocol/Internet Protocol (TCP/IP) networking protocol for creating remote sessions. On the web, Hypertext Transfer Protocol (HTTP) and File Transfer Protocol (FTP) simply enable users to request specific files from remote computers, while, through Telnet, users can log on as a regular user with the privileges they are granted to the specific applications and data on that computer.


telnet [options] hostname/IP address


-4Force IPv4 address resolution.
-6Force IPv6 address resolution.
-8Request 8-bit operation. This option causes an attempt to negotiate the TELNET BINARY option for both input and output. By default, telnet is not “8-bit clean” (it does not recognize 8-bit character encodings such as Unicode).
-EDisables the escape character functionality; that is, sets the escape character to “no character”.
-LSpecifies an 8-bit data path on output. This option causes the TELNET BINARY option to be negotiated on output.
-aAttempt automatic login. Currently, this sends the username via the USER variable of the ENVIRON option if supported by the remote system. The username is retrieved via the getlogin system call.
-b addressUse bind on the local socket to bind it to a specific local address.
-dSets the initial value of the debug toggle to TRUE.
-rEmulate rlogin. 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 causes telnet to disconnect from the remote host. A ^Z (Control-Z) instead of a dot suspends telnet, and a ^] (Control-close bracket, the default telnet escape character) generates a normal telnet prompt. These codes are accepted only at the beginning of a line.
-S tosSets the IP TOS (type-of-service) option for the telnet connection to the value tos.
-e escapecharSets the escape character to escapechar. If no character is supplied, no escape character will be used. Entering the escape character while connected causes telnet to drop to command mode.
-l userSpecify user as the user to log in as on the remote system. By sending the specified name as the USER environment variable, so it requires that the remote system support the TELNET ENVIRON option. This option implies the -a option, and may also be used with the open command.
-n tracefileOpens tracefile for recording trace information. See the set tracefile command below.
hostSpecifies a host to contact over the network.
portSpecifies a port number or service name to contact. If not specified, the telnet port (23) is used.


  1. Check the listen port

You can use this command for check the connection of a application.


telnet 80  <- http

telnet 25  <- smtp

  1. Check Connection and Close Connection.

# telnet localhost 25


Connected to localhost.localdomain (

Escape character is ‘^]’.

220 office-sv1 ESMTP Sendmail 8.13.8/8.13.8; Mon, 28 Mar 2011 08:01:08 +0900

^]                                 <- Ctrl ]

telnet> quit

Connection closed.

  1. Web Server

# telnet localhost 80


Connected to (

Escape character is ‘^]’.

GET / HTTP/1.0                       <-  Enter 2 times (http://localhost/index.html)

HTTP/1.1 200 OK

Date: Wed, 29 Jul 2009 15:16:50 GMT

Server: Apache/1.3.37 (Unix) mod_fastcgi/2.4.6 mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.4.7 abbr.

Last-Modified: Mon, 05 Feb 2007 11:04:57 GMT

ETag: “1b200-b2c-45c70f59”

Accept-Ranges: bytes

Content-Length: 2860

Connection: close

Content-Type: text/html







Connection closed by foreign host.


  1. Mail Server

send mail

# telnet localhost 25


Connected to test-server.test-server (

Escape character is ‘^]’.

220 test-server.example-sec.local ESMTP

helo localhost

250 test-server.example-sec.local


250 ok


250 ok

502 unimplemented (#5.5.1)


354 go ahead



Subject: test

this is test.


250 ok 1184072108 qp 20747

502 unimplemented (#5.5.1)


221 test-server.example-sec.local

Connection closed by foreign host.