← 返回命令列表

Linux command

telnet 命令

网络

需要网络或远程资源。

常用示例

Connect to a host

telnet [host]

Connect to a host

telnet [host] [port]

Test if a port is open

telnet [host] [80]

Connect with automatic login

telnet -a [host]

Connect as a specific user

telnet -l [username] [host]

Set a custom escape character

telnet -e [^X] [host]

Force IPv4 connection

telnet -4 [host]

说明

telnet is a user interface to the TELNET protocol for communicating with remote hosts. It can connect to any TCP port, making it useful for testing network services beyond traditional terminal access. Without arguments, telnet enters command mode with a telnet> prompt. With a host argument, it attempts to connect immediately. The escape character (default Ctrl+]) returns to command mode during a connection. Common uses include testing web servers (port 80), mail servers (port 25), and verifying if network services are accessible. The protocol transmits data in plaintext without encryption.

参数

-4
Force IPv4 address resolution
-6
Force IPv6 address resolution
-8
Request 8-bit data path
-a
Attempt automatic login with current username
-l _USER_
Specify username for automatic login
-e _CHAR_
Set escape character (default: ^])
-E
Disable escape character
-d
Enable debug mode
-n _FILE_
Record trace information to file
-K
Disable automatic login
-L
Use 8-bit data path on output only
-7
Strip 8th bit on input and output

FAQ

What is the telnet command used for?

telnet is a user interface to the TELNET protocol for communicating with remote hosts. It can connect to any TCP port, making it useful for testing network services beyond traditional terminal access. Without arguments, telnet enters command mode with a telnet> prompt. With a host argument, it attempts to connect immediately. The escape character (default Ctrl+]) returns to command mode during a connection. Common uses include testing web servers (port 80), mail servers (port 25), and verifying if network services are accessible. The protocol transmits data in plaintext without encryption.

How do I run a basic telnet example?

Run `telnet [host]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -4 do in telnet?

Force IPv4 address resolution