我正在尝试使用 telnet 连接服务器,但是当我输入 telnet localhost 8000 时,它显示 telnet not found 的错误。我用 C 编写了我的代码并在 macOS 终端上运行它。我应该先安装一些东西才能使用它吗?
1 个回答 正确答案
是的,您需要安装 telnet 才能在您的 Mac 上使用它。您也可以尝试使用预装在 macOS 机器上的替代工具。它被调用netcat
,您可以执行以下操作:
nc -vz localhost 8000
如果上面的命令不够好,您可以按照可以在此处找到的教程在您的 Mac 上安装 telnet:
https://osxdaily.com/2018/07/18/get-telnet-macos/
更准确地说,该部分标题为: Installing Telnet in MacOS with Homebrew
您需要安装 homebrew(它是 MacOS 的包管理器,类似于 linux 中的 yum 或 apt)。
I'm trying to connect the server using telnet, but when I enter telnet localhost 8000. It shows the error of telnet not found. I wrote my code in C and ran it on macOS terminal. Am I supposed to install something before I can use it?
- 1
- Sorry if that is confusing. I also ran it on Linux and Mac terminal, but having the same problem. Feb 3 at 18:09
- telnet doesn't come by default on Mac (at least, it's not on my MacBook). You can see here for how to install it. Feb 3 at 18:09
telnet
is a somewhat outdated standard program. Apparently you have to install it. For details how to install it on Linux you would have to tell your Linux distribution and version. Please edit your question to add information or clarification. Don't use comments for this purpose.– BodoFeb 3 at 18:11- To mark the question as solved you would have to accept an answer or write your own answer and accept it. Regarding this specific question, the answer should contain details about how exactly you installed
telnet
.– BodoFeb 3 at 18:23
1 Answer
Yes you would need to install telnet to use it on your mac. You can also try using an alternative tool, that comes pre-installed on macOS machines. It is called netcat
and you can do the following:
nc -vz localhost 8000
If the command above is not good enough, you can install telnet on your mac by following the tutorial that can be found here:
https://osxdaily.com/2018/07/18/get-telnet-macos/
More precisely, the section titled: Installing Telnet in MacOS with Homebrew
You will need to install homebrew (it is a package manager for MacOS, similar to yum or apt in linux).
- I am not sure if we are allowed to share 3rd party links here but if you google 'install telnet macos' you'll find plenty of tutorials– MackoFeb 3 at 18:11
- Please edit your answer to add information instead of writing a comment. Yes, you can show a link to a tutorial, but you should also cite the relevant part in your answer, so that the essential answer is found here directly.– BodoFeb 3 at 18:15
Not the answer you're looking for? Browse other questions tagged ask your own question. or
来自 https://stackoverflow.com/questions/70976178/bash-telnet-command-not-found
telnet
是一个有点过时的标准程序。显然你必须安装它。有关如何在 Linux 上安装它的详细信息,您必须告诉您的 Linux 发行版和版本。请编辑您的问题以添加信息或说明。不要为此目的使用注释。telnet
。