在 Ubuntu 系统中,telnet
命令用于连接到远程服务器
-
打开终端(Terminal)。
-
输入
telnet [服务器地址] [端口号]
,例如:telnet example.com 80
。按 Enter 键执行命令。 -
如果连接成功,你将看到类似以下的输出:
Trying xxx.xxx.xxx.xxx... Connected to example.com. Escape character is '^]'.
这表示你已经成功连接到了目标服务器。Trying
行显示了服务器的 IP 地址和你尝试连接的端口号。Connected to
行显示了你所连接的服务器的域名。
- 现在你可以输入命令与服务器进行交互。例如,如果你连接到了一个 HTTP 服务器,你可以输入
GET / HTTP/1.1
并按 Enter 键。服务器将返回 HTTP 响应,例如:
HTTP/1.1 200 OK Date: Mon, 28 Oct 2019 12:34:56 GMT Content-Type: text/html; charset=UTF-8 Content-Length: 138 Connection: closeExample Domain Example Domain
This domain is for use in illustrative examples in documents.
- 当你完成与服务器的交互后,可以输入
quit
命令并按 Enter 键退出telnet
。
请注意,telnet
不是一个加密的协议,因此在传输敏感信息时可能会被窃听。对于安全的远程连接,建议使用 SSH(Secure Shell)协议。