欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

bash: telnet: command not found [closed] 用 nc 命令来替代 有大用 有大大用

 
浏览 5k 次
1

我正在尝试使用 telnet 连接服务器,但是当我输入 telnet localhost 8000 时,它显示 telnet not found 的错误。我用 C 编写了我的代码并在 macOS 终端上运行它。我应该先安装一些东西才能使用它吗?

  • 1
    如果您使用的是 Mac,为什么要标记这个 Linux?和 C? 
    – 肖恩
     2 月 3 日 18:07 
  • 对不起,如果这令人困惑。我也在 Linux 和 Mac 终端上运行它,但遇到了同样的问题。 
    – 天涌
     2 月 3 日 18:09
  • Mac 上默认不提供 telnet(至少,它不在我的 MacBook 上)。您可以在此处查看如何安装它。  2 月 3 日 18:09 
  • telnet是一个有点过时的标准程序。显然你必须安装它。有关如何在 Linux 上安装它的详细信息,您必须告诉您的 Linux 发行版和版本。编辑您的问题以添加信息或说明。不要为此目的使用注释。  2 月 3 日 18:11 
  • 要将问题标记为已解决,您必须接受答案或编写自己的答案并接受它。关于这个特定问题,答案应包含有关您如何安装的详细信息telnet  2 月 3 日 18:23

1 个回答  正确答案

4

是的,您需要安装 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)。

不是您要找的答案?浏览标记的其他问题或者问你自己的问题



Asked 
Modified 7 months ago
Viewed 5k times
1

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
    Why tag this Linux if you're using a Mac? And C? 
    – Shawn
     Feb 3 at 18:07 
  • 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. 
    – Bodo
     Feb 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. 
    – Bodo
     Feb 3 at 18:23

1 Answer

4

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).

Not the answer you're looking for? Browse other questions tagged  or ask your own question.


来自  https://stackoverflow.com/questions/70976178/bash-telnet-command-not-found





普通分类: