telnet — Open a plaintext TCP session — legacy terminal + port-probe tool across all 5 shells
Equivalents in every shell
telnet example.com 25Connects to a remote TCP port and starts a line-oriented session. SSH replaced `telnet` for shell access 25+ years ago — the only remaining legitimate uses are (1) port probing (`telnet host 25` shows the SMTP greeting), (2) BBS / MUD access, (3) embedded device serial-over-TCP. Any credentials traverse the wire in PLAINTEXT.
telnet example.com 25Same external. macOS REMOVED `telnet` from the base install starting 10.13 (High Sierra) — install via `brew install telnet`, or use the shipped `nc` (BSD netcat) for port probing: `nc -vz example.com 25`.
telnet example.com 25Same external. For port-probe use, fish makes piping cleaner: `echo '' | nc -w 2 example.com 25`. No fish-specific telnet completion or special handling.
Test-NetConnection -ComputerName example.com -Port 25 -InformationLevel DetailedPowerShell-native port probe (Windows 8 / Server 2012+). Returns a `[NetConnectionResult]` with `TcpTestSucceeded`, `RemoteAddress`, `PingSucceeded`. For raw socket I/O use `[System.Net.Sockets.TcpClient]::new('example.com',25)` and read its `NetworkStream` — closer to telnet semantics.
telnet example.com 25NOT installed by default since Windows Vista. Enable with `dism /Online /Enable-Feature /FeatureName:TelnetClient`. Microsoft recommends OpenSSH for any auth use and `Test-NetConnection` for probes — the bundled `curl.exe` (Win10 1803+) covers HTTP port probing without enabling the legacy capability.
Worked examples
Check whether an SMTP server is reachable on port 25
telnet smtp.example.com 25Test-NetConnection -ComputerName smtp.example.com -Port 25telnet smtp.example.com 25Quick port-open probe with a 2-second timeout and clear exit code
nc -vz -w 2 example.com 80nc -vz -w 2 example.com 80(Test-NetConnection -ComputerName example.com -Port 80 -WarningAction SilentlyContinue).TcpTestSucceededManual SMTP HELO conversation for debugging
(printf 'HELO test\r\nQUIT\r\n'; sleep 1) | telnet smtp.example.com 25$c = [System.Net.Sockets.TcpClient]::new('smtp.example.com',25); $r = [IO.StreamReader]::new($c.GetStream()); $r.ReadLine()Gotchas
- `telnet` is DEPRECATED for any use involving authentication — credentials traverse the network in cleartext. Anything that asks for a login (mail submission, router admin, FTP-over-telnet) should be migrated to SSH (`ssh user@host`) or a TLS-wrapped equivalent. Keep `telnet` only for non-credentialed probes.
- Windows removed `telnet` from the default install starting Vista. `dism /Online /Enable-Feature /FeatureName:TelnetClient` enables it; the PowerShell-native `Test-NetConnection -Port` is the recommended modern probe and works on every Windows 8+ install without elevation or extra capabilities.
- macOS removed `telnet` from the base system in 10.13 (High Sierra). The shipped replacement is `nc` (BSD netcat) — `nc -vz example.com 25` does a connect-and-close probe with verbose output and a portable exit code (`0` = open, `1` = closed/filtered).
- Microsoft's `telnet.exe` ignores Ctrl-C. To exit, press Ctrl-] (close bracket) — this opens the in-program prompt; type `quit` and Enter. Many Unix `telnet` clients use the same escape but the shortcut is undiscoverable from the UI.
- Some firewalls return TCP RST immediately on probe — `telnet` reports `Connection refused`. Others silently DROP — `telnet` hangs forever waiting for a response. Always set `nc -w 2` or `Test-NetConnection -InformationLevel Quiet` plus a timeout job; never rely on `telnet` itself to time out (it doesn't).
WSL & PowerShell Core notes
Common tasks using telnet
- Send raw TCP data to a port
Push arbitrary bytes (an HTTP request, a SMTP greeting, a custom protocol probe) to a remote TCP port and inspect the reply — for debugging service compatibility, capturing banners, reproducing protocol-level bugs, or scripting integrations with text-based protocols.
- Test a TCP connection with nc
Confirm whether you can open a TCP socket to host:port — the basic "is this thing reachable" check before debugging deeper protocol issues.