在 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 行显示了你所连接的服务器的域名。
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: close <html> <head> <title>Example Domain</title> </head> <body> <div> <h1>Example Domain</h1> <p>This domain is for use in illustrative examples in documents.</p> </div> </body> </html> quit 命令并按 Enter 键退出 telnet。请注意,telnet 不是一个加密的协议,因此在传输敏感信息时可能会被窃听。对于安全的远程连接,建议使用 SSH(Secure Shell)协议。