Home·Terminal commands

telnet

Networking

Usage

telnet <host> <port>

Opens a plain TCP session in which everything travels in clear text, so it must never be used to log in (that is ssh); its remaining use is checking whether a port answers, and you leave with Ctrl+] then quit.

Common flags

FlagMeaning
<host> <port>Open a raw TCP connection and type into it.
Ctrl+] then quitHow to get out when the far end never closes.
-4 / -6Force one address family.
-e <char>Choose a different escape character.

Examples

telnet example.com 80

Then type: GET / HTTP/1.0 and press enter twice.

telnet 192.168.1.1 22

Read the SSH banner to confirm the service answers.

When a connection fails, these narrow down how far it got — name not resolving, no route, or a blocked port.

How to read this

  • Square brackets [ ] mark a part you may leave out.
  • An ellipsis … means you can list more than one.
  • Flags are case-sensitive — in some commands -r and -R do different things.

Questions

Q. What does telnet do?

Opens a plain TCP session in which everything travels in clear text, so it must never be used to log in (that is ssh); its remaining use is checking whether a port answers, and you leave with Ctrl+] then quit.

Q. How do I type it?

telnet <host> <port> — square brackets mark the parts you can leave out.

Q. How many flags are worth knowing?

4 are listed here; the full set is in man telnet. This command sits under Networking.

Related commands

man page: man telnet